Hello, 各位同胞,最近好久没有发帖了,为了证明我的死活,我决定将我的压箱底放出来。但是会更新,我最近进程较慢,大家帮我指点一下,谢谢!
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
double n2 = 0;
double b2 = 0;
int k = 1;
void GM()//标签
{
system("cls");
printf("=================================================================================\n");
printf("\t\t\t Stein calculator\n");
printf("=================================================================================\n");
printf("\n\n");
}
void YS()//有余数的除法
{
int n = 0;
int b = 0;
printf("Please enter the dividend:\n");
scanf("%d", &n);
printf("Please enter the divisor:\n");
scanf("%d", &b);
printf("%d / %d = %d %d\n", n, b, n / b, n % b);
}
void WYS()//没有余数的除法
{
printf("Please enter the dividend:\n");
scanf("%lf", &n2);
printf("Please enter the divisor:\n");
scanf("%lf", &b2);
printf("%f / %f = %f\n", n2, b2, n2 / b2);
}
void Js()//加法
{
printf("Please enter an addition1:\n");
scanf("%d", &n2);
printf("Please enter an addition2:\n");
scanf("%d", &b2);
printf("%d + %d= %d\n", n2, b2, n2 + b2);
}
void Mi()//减法
{
printf("Please enter the minus number1:\n");
scanf("%d", &n2);
printf("Enter the minus number2:\n");
scanf("%d", &b2);
printf("%d - %d= %d\n", n2, b2, n2 - b2);
}
void Ml()//乘法
{
printf("Please enter the multiplier1:\n");
scanf("%lf", &n2);
printf("Please enter the multiplier2:\n");
scanf("%lf", &b2);
printf("%f * %f = %f\n", n2, b2, n2 * b2);
}
void Dv()//除法集体
{
int yu;
printf("Is there a remainder?(There are 1, but only the total number of support!):\n");
scanf("%d", &yu);
GM();
if(yu == 1)
{
YS();
}
else
{
WYS();
}
}
void NO()//错误判断
{
GM();
printf("SIGN INPUT ERROR!\n");
}
void GO()//开始运算
{
int h;
GM();
printf("Please enter mode?\naddition=1\nsubtraction=2\nmultiplication=3\ndivision=4\n");
scanf("%d", &h);
GM();
if(h == 1)
{
Js();
}
else if(h == 2)
{
Mi();
}
else if(h == 3)
{
Ml();
}
else if(h == 4)
{
Dv();
}
else
{
NO();
}
}
void BAY()//退出运算流程
{
printf("Whether to continue (exit: 1):\n");
scanf("%d", &k);
GM();
if(k == 1)
k = 0;
else
k = 1;
}
int main(void)
{
while(k == 1)
{
GO();
//进入运算流程
BAY();
//退出运算流程
}
printf("Bay-bay");
return 0;//退出程序
}
|