#include<bits/stdc++.h>
#include<windows.h>
#include <conio.h> // Note: This is only valid on Windows
#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
/*
a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<""<<b<<"="<<ab;
return 0;
*/
void color(short x) {
if(x>=1 && x<=15)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x);
else
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}
void _2D();void _3D();
void Calculate_Area(){
system("cls");
cout<<"1:2D\n2:3D";
char _bool;
cin>>_bool;
switch(_bool){
case'1':_2D();break;
case'2':_3D();break;
}
}
void Rectangular_prism(){
float a,b,c;
cout<<"输入长宽高";
cin>>a>>b>>c;
cout<<"面积:"<<a*b*2+a*c*2+b*c*2<<endl<<"周长:"<<(a+b+c)*4;
}
void cube(){
float a;
cout<<"输入边长:";
cin>>a;
cout<<"面积:"<<a*a*6<<endl<<"周长:"<<a*12;
}
void _3D(){
system("cls");
cout<<"1:长方体2:正方体";
char _bool;
cin>>_bool;
system("cls");
switch(_bool){
case'1':Rectangular_prism();break;
case'2':cube();
}
}
void rectangle(){
float a,b;
cout<<"输入长宽:"<<endl;
cin>>a>>b;
cout<<"面积:"<<a*b<<endl<<"周长:"<<(a+b)*2;
}
void square(){
float a;
cout<<"输入边长:"<<endl;
cin>>a;
cout<<"面积:"<<a*a<<endl<<"周长:"<<a*4;
}
void triangle(){
float a,b,c,h;
cout<<"输入三条边,高:"<<endl;
cin>>a>>b>>c>>h;
if(a<(b+c)){
cout<<"周长:"<<a+b+c<<endl<<"面积:"<<a*h/2;
}
if(b<(a+c)){
cout<<"周长:"<<a+b+c<<endl<<"面积:"<<b*h/2;
}else if(c<(a+b)){
cout<<"周长:"<<a+b+c<<endl<<"面积:"<<c*h/2;
}else{
cout<<"不是正方形";
}
}
void _2D(){
system("cls");
cout<<"1:长方形\n2:正方形\n3:三角形"<<endl;
char _bool;
cin>>_bool;
system("cls");
switch(_bool){
case'1':
rectangle();
break;
case'2':
square();
break;
case'3':
triangle();
break;
default:
cout<<"没此选项";
}
}
void painting(){
int a,b,d;
system("cls");
cout<<"[输入长宽]";
cin>>a>>b;
string n;
system("cls");
cout<<"输入花纹:";
cin>>n;
system("cls");
cout<<"图案颜色1蓝色,2绿色,3湖蓝色,4红色,5紫色,6黄色,7白色,8灰色,9淡蓝色,10淡绿色,11淡浅绿色,12淡红色,13淡紫色,14淡黄色,15亮白色,大于等于0,16默认:";
cin>>d;
color(d);
for(int i=0;i<b;i++){
for(int i1=0;i1<a;i1++){
cout<<n;
}
cout<<endl;
}
color(8);
}
void Graphic_Control_Panel(){
system("cls");
cout<<"1:计算面积周长\n2:绘画\n";
char _bool;
cin>>_bool;
switch(_bool){
case'1':
Calculate_Area();break;
case'2':
painting();
break;
}
}
void Take_surplus(){
int a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"%"<<b<<"="<<a%b;
}
void addition(){
int a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"+"<<b<<"="<<a+b;
}
void addition_f(){
float a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"+"<<b<<"="<<a+b;
}
void subtraction(){
int a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"-"<<b<<"="<<a-b;
}
void subtraction_f(){
float a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"-"<<b<<"="<<a-b;
}
void multiplication(){
int a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"*"<<b<<"="<<a*b;
}
void multiplication_f(){
float a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"*"<<b<<"="<<a*b;
}
void division(){
int a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
if (b==0) cout<<"425";Sleep(1000); for(int i=1;i<=100;i++) MessageBox (NULL, "Dev-C++\n应用程序已崩溃\nThe application has crashed.", "425",MB_OK);
if(b!=0) cout<<a<<"/"<<b<<"="<<a*b;
}
void division_f(){
float a,b;
cout<<"输入2数字值|<a|b>|";cin>>a>>b;
cout<<a<<"/"<<b<<"="<<a/b;
}
void How_to_be_the_same(){
cout<<"输入2数字值|<a|b>|";
int a,b;
cin>>a>>b;
if(a>b) cout<<"b+"<<a-b<<"="<<a<<"或"<<a<<"-"<<a-b<<"="<<b;
if(a<b) cout<<"a+"<<b-a<<"="<<b<<"或"<<b<<"-"<<b-a<<"="<<a;
else cout<<a<<"="<<b;
}
void How_to_be_the_same_f(){
cout<<"输入2数字值|<a|b>|";
float a,b;
cin>>a>>b;
if(a>b) cout<<b<<"+"<<a-b<<"="<<a<<"或"<<a<<"-"<<a-b<<"="<<b;
if(a<b) cout<<a<<"+"<<b-a<<"="<<b<<"或"<<b<<"-"<<b-a<<"="<<a;
if(a==b) cout<<a<<"="<<b;
}
void Integer_operation_control_panel(){
system("cls");
cout<<"+:加法\n-:减法\n/:除法\n*:乘法\n%:取余\n=:如何一样"<<endl;
char _bool;
cin>>_bool;
system("cls");
switch(_bool){
case'+':
addition();break;
case'-':
subtraction();break;
case'*':
multiplication();break;
case'/':
division();break;
case '%':
Take_surplus();break;
case'=':
How_to_be_the_same();break;
default:
cout<<"退出";
}
}
void Decimal_operation_control_panel(){
system("cls");
cout<<"+:加法\n-:减法\n/:除法\n*乘法\n=:如何一样"<<endl;
char _bool;
cin>>_bool;
system("cls");
switch(_bool){
case'+':
addition_f();break;
case'-':
subtraction_f();break;
case'*':
multiplication_f();break;
case'/':
division_f();break;
case'=':
How_to_be_the_same_f();break;
default:
cout<<"退出";
}
}
int main(){
cout<<" _________"<<endl;
cout<<"/ |"<<endl;
cout<<"[ KOREA ]"<<endl;
cout<<"|[选择] |"<<endl;
cout<<"[1]整数 |"<<endl;
cout<<"[2]小数 |"<<endl;
cout<<"[3]图形 |"<<endl;
cout<<"[其他退出]"<<endl;
cout<<"|________/"<<endl;
MessageBox (NULL, "▇▇ ▇▇Windows11\n▇▇ ▇▇Dev-C++\n_____________________________________________________________________________________\nMicrosoft Windows\n版本 1.0(OS 内部版本 1.0.11.12)\n(c)清北互联木材保留所有权利。\n\n操作及其用户受清北互联木材和CSDN商标法和其他待颁布或已颁布的知识产权法保护\n\n\n\n\n\n\n根据Korea 软件许可条款,许可如下用户使用本产品:\n\n Korea\n\n 组织名称", "关于“计算机”",MB_OK);
int g;
cin>>g;
if(g==1){
Integer_operation_control_panel();
}else if(g==2){
Decimal_operation_control_panel();
}else if(g==3){
Graphic_Control_Panel();
}else{
system("cls");cout<<"再见"<<endl;
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容