This procedure is the last time the development of the program, I see myself as another developer, in front of their own procedures to re-examine, have a different feeling, their own program, must be for others (also may be their own) to leave a way to stay alive. Gossip does not say much, into everyone's favorite * * link.
Requirements: Each classmate choose a direction, the program to expand the program can accept the user input answers, and determine the right and wrong. Finally, the total number of pairs/errors is given.
Design idea: Because I stored the original operation in the chain list, and the implementation of the linked list of the display, on this basis to achieve the user's answer verification, it is not so difficult, just to let users see what he should do, let him enter the answer, the program for its verification. The parameter passing details of the design between functions are not detailed.
1 intCount (intFirstintSecondCharthird)2 {3 Switch(third)4 {5 Case '+':6 return(first+second);7 Case '-':8 return(first-second);9 Case '*':Ten return(first*second); One Case '/': A return(first/second); - default : - return 0; the } - - } - + intUserusing (Linknode &L) - { + intright=0; A intrecord; atLinknode p=l->Next; - while(P! =NULL) - { -cout<<"Please enter the result of the calculation:"; -cout<<p->num1<<p->ope<<p->num2<<"="; -Cin>>record; in if(Record==count (p->num1,p->num2,p->ope)) -right++; toP=p->Next; + } - returnRight ; the } * voidShow (intZongtishu,intzhengque) $ {Panax Notoginsengcout<<"congratulations on your answer."<<zhengque<<"Road Topics"<<Endl; - if(zongtishu-zhengque!=0) the { +cout<<"but I'm sorry you're wrong."<< (Zongtishu-zhengque) <<"Road Topics"<<Endl; A } the}
Program design time did not do a detailed record, but there is a I feel that there is a learning point, in the program after the start did not run, and then tested once, when the user answers all correct, the program will still remind the wrong 0 questions, which is very awkward, then made some adjustments. Determine if there is a wrong answer to the question, and then output. Another aspect is the beginning to design two values one to answer the correct question, the other record to answer the wrong number of questions, but so with only one data, the other by the total minus the data you recorded, the complexity of the code will be reduced.
User-Programmable Quiz program