标签:
1 int Count(int first,int second,char third) 2 { 3 switch(third) 4 { 5 case ‘+‘: 6 return (first+second); 7 case ‘-‘: 8 return (first-second); 9 case ‘*‘: 10 return (first*second); 11 case ‘/‘: 12 return (first/second); 13 default : 14 return 0; 15 } 16 17 } 18 19 int UserUsing(linknode &L) 20 { 21 int right=0; 22 int record; 23 linknode p=L->next; 24 while(p !=NULL) 25 { 26 cout<<"请输入计算结果:"; 27 cout<<p->num1<<p->ope<<p->num2<<"="; 28 cin>>record; 29 if(record==Count(p->num1,p->num2,p->ope)) 30 right++; 31 p=p->next; 32 } 33 return right; 34 } 35 void Show(int zongtishu,int zhengque) 36 { 37 cout<<"恭喜您答对了"<<zhengque<<"道题目"<<endl; 38 if(zongtishu-zhengque!=0) 39 { 40 cout<<"但很遗憾您答错了"<<(zongtishu-zhengque)<<"道题目"<<endl; 41 } 42 }
标签:
原文地址:http://www.cnblogs.com/dzgl/p/4423160.html