[原创]我把我写的源程序帖上来。。。
main()
{int i=0,n,one=0,two=0,three=0,four=0,five=0,six=0,seven=0,eight=0,nine=0;
char m;
printf("\n\nThis is a test of your Intelligence....please answer the questions below:\nIt's said that Bill Gates has got only 3 points...");
printf("There are 9 questions in all....\n");
printf("question 1: Does July 1st exist in England ?\npress y for yes and press n for no..\n");
scanf("%c",&m);
if(m=='y')
{
i++;
one++;
}
printf("question 2: How many birthdaies does a person have in all his life ?\njust input the number..\n");
scanf("%d",&n);
if(n==1)
{
i++;
two++;
}
printf("question 3: It is known to all that a month may have 31 days and 30 days,\nso how many months have 28 days in one year ?\n");
scanf("%d",&n);
if(n==12)
{
i++;
three++;
}
printf("question 4: How many people will attend in each Baseball match ?\n");
scanf("%d",&n);
if(n==6){
i++;
four++;
}
printf("question 5: You have a dozen of 3 yuan stamps, how many stamps do you have ?\n");
scanf("%d",&n);
if(n==12)
{
i++;
five++;
}
printf("question 6: 30 divides 1/2 and then adds on 10,what is the result ?\n");
scanf("%d",&n);
if(n==70){
i++;
six++;
}
printf("question 7: There are 3 apples on the table and you pick 2 of them , how many\napples do you have ?\n");
scanf("%d",&n);
if(n==2){
i++;
seven++;
}
printf("question 8: The doctor gave you 3 grain of pills,and told you have\n one each 30 minutes,how long will you take to eat all these 3 grain of pills ?\nTake the minute as the unit\n");
scanf("%d",&n);
if(n==60)
{
i++;
eight++;
}
printf("question 9: A farmer has 17 sheep,all sheep died of illness except 9 sheep,\nhow many sheep do the farmer also have ?\n");
scanf("%d",&n);
if(n==9)
{
i++;
nine++;
}
printf("\n\n***The test is end and your score is %d points***\n\n",i);
printf("according to your score,the result of your test is:\n\n");
if(i<=1)
printf("******I don't know what should be said to discribe you Intelligence...******\n");
if(i>=2&&i<=4)
printf("******you have the Intelligence of Bill Gates....******\n");
if(i>=5&&i<7)
printf("******Your Intelligence is very normal....******\n");
if(i==7)
printf("******Your performance is very good,must be a outstanding student in your school******\n");
if(i>7)
printf("******ohhhhhhhhhh,you can go to the microsoft company to work, \nit's said that only 3 persons can get this point in a hundred people\n..Congratulations...******\n");
if(i!=9)
{printf("\n\npress space to see the right answers for the questions you answered wrongly...\n");
getch();
printf("\n\n***The following lists are your wrong answers and I give the right answers\n as follows***\n\n");
if(one==0)printf("question 1:THE RIGHT ANSWER IS :YES..BECAUSE EVERY COUNTRY HAS JULY 1ST........\n\n");
if(two==0)printf("question 2:THE RIGHT ANSWER IS :1...EVERYONE HAS ONLY ONE BIRHTDAY....\n\n");
if(three==0)printf("question 3:THE RIGHT ANSWER IS :12...EVERY MONTH HAS 28 DAYS....\n\n");
if(four==0)printf("question 4:THE RIGHT ANSWER IS :6...\n\n");
if(five==0)printf("question 5:THE RIGHT ANSWER IS :12...A DOZEN REPLACES 12...\n\n");
if(six==0)printf("question 6:THE RIGHT ANSWER IS :70...30 DIVIDES 1/2 NOT 2...\n\n");
if(seven==0)printf("question 7:THE RIGHT ANSWER IS :2...YOU PICK 2 OF THE APPLES SO YOU HAVE TWO..\n\n");
if(eight==0)printf("question 8:THE RIGHT ANSWER IS :60...WHEN YOU TAKE THE FIRST PILL YOU SHOULD NOT WAIT..\n\n");
if(nine==0)printf("question 9:THE RIGHT ANSWER IS :9...SIMPLE QUESTION...THINK IT AGAIN...\n\n");
}
printf("\nWRITEN BY *HAILANXIAO* QQ:4852150\n");
getch();
}
这是我的这个测试程序的整个源程序,很简单,没有什么复杂的算法,只是打进去的字比较多而已。。。。
请大家看看我这个程序还有什么地方可以优化的,或者让其编译后执行更快一点。。。。