标签:include using while ++ 矩形 name 长方形 code bsp
#include "pch.h"
#include<iostream>
using namespace std;
const float PI = 3.1415926;
int main() {
int iType;
float readius, a, b;
while (true){
cout << "图形的类型为?(1-圆形 2-长方形 3-正方形)";
cin >> iType;
switch (iType) {
case 1:
cout << "请输入圆形的直径";
cin >> readius;
cout << "圆的面积为" << readius * PI << "平方厘米" << endl;
break;
case 2:
cout << "矩形的长为:";
cin >>a;
cout << "矩形的宽位";
cin >> b;
cout << "矩形的面积为:" << a * b << "平方厘米" << endl;
break;
case 3:
cout << "请输入正方形的边长";
cin >> a;
cout << "正方形面积为" << a * a << "平方厘米" << endl;
}
}
}
标签:include using while ++ 矩形 name 长方形 code bsp
原文地址:https://www.cnblogs.com/zhangdingqu/p/10326061.html