主题:用C++设计一个简单计算器
我是个新手,各位大侠帮帮小弟吧。
要求: 在功能上功能尽量模拟windows操作系统中的计算器,系统界面不做强制要求。
功能说明:程序首先显示计算器界面,并等待用户输入一个算术计算式。假如用户输入22+1<CR>,程序将在计算器的显示屏上输出计算结果。如果输入错误,显示input error!。
计算器的界面程序已经提供:
#include <stdio.h>
#include <conio.h>
void main()
{
float a,b;
char c;
clrscr();
gotoxy(1,2);
printf("——————————————\n");
printf("? \n");
printf("——————————————\n");
printf("? 1 2 3 + - \n");
printf("? \n");
printf("? 4 5 6 * / \n");
printf("? \n");
printf("? 7 8 9 = \x1b \n");
printf("? \n");
printf("? 0 . End \n");
printf("——————————————/n");
gotoxy(2,3);
//following codes get user's input and complete the calculation
//add your codes down here!
//add your codes up here!
}
要求: 在功能上功能尽量模拟windows操作系统中的计算器,系统界面不做强制要求。
功能说明:程序首先显示计算器界面,并等待用户输入一个算术计算式。假如用户输入22+1<CR>,程序将在计算器的显示屏上输出计算结果。如果输入错误,显示input error!。
计算器的界面程序已经提供:
#include <stdio.h>
#include <conio.h>
void main()
{
float a,b;
char c;
clrscr();
gotoxy(1,2);
printf("——————————————\n");
printf("? \n");
printf("——————————————\n");
printf("? 1 2 3 + - \n");
printf("? \n");
printf("? 4 5 6 * / \n");
printf("? \n");
printf("? 7 8 9 = \x1b \n");
printf("? \n");
printf("? 0 . End \n");
printf("——————————————/n");
gotoxy(2,3);
//following codes get user's input and complete the calculation
//add your codes down here!
//add your codes up here!
}