【#文档大全网# 导语】以下是®文档大全网的小编为您整理的《C语言 简单计算器程序 源代码》,欢迎阅读!
#include #include #include #include
int MoveCursor(int x,int y);
int main() {
float a,b; char c;
MoveCursor(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");
MoveCursor(2,3); {
char ch; int a,b;
printf("Enter formula:"); scanf("%d%c%d",&a,&ch,&b); switch(ch) {
case '+':printf("%d+%d=%d\n",a,b,a+b);break; case '-':printf("%d-%d=%d\n",a,b,a-b);break; case '*':printf("%d*%d=%d\n",a,b,a*b);break; case '/':printf("%d/%d=%d\n",a,b,a/b); }
system("pause"); }
}
int MoveCursor(int x,int y) {
HANDLE handle=GetStdHandle(STD_OUTPUT_HANDLE); COORD ord; ord.X=x; ord.Y=y;
SetConsoleCursorPosition(handle,ord);
return 1; }
本文来源:https://www.wddqxz.cn/e55580c59ec3d5bbfd0a7456.html