1.创建c语言项目
点击文件——新建——项目
选择Console Application并勾选c项目,完成创建
创建完成后效果如图;现在可以编写c程序了
2.编写程序;代码实现完成加减乘除运算(使用switch实现)
下面展示 实现加减乘除完整的代码
。
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int a,b,d=0;
char c;
while(d==0)
{
printf("请开始计算,请输入需要运算的数字和运算法则,数字符号数字:");
scanf("%d%c%d",&a,&c,&b);
switch(c)
{
case'