Have you ever thought about making your own game and programming it by yourself? Then this is your chance! This is my project for a class called Programming Application for Engineering - CS159 - American University of The Middle East (AUM) - Spring 2016.
We were supposed to make a jeopardy game that has three levels which are easy, intermediate, and difficult level. When you answer a question correctly, your score will increase based on the points of that question. When you reach the end of the level, you will be asked if you want to save your score or not as well as if you want to see your previous score. After that you will be asked if you want to play a new session.
The coding program used in the code below is called Microsoft Visual Studio. And we used c++ language.
#include<stdio.h>
#include<stdlib.h>
void simple(int score);//add function simple level massege
void Intermediate(int score);//add function intermediate level
void Difficult(int score); //a function for the difficult level and all its questions
void welcomeScreen(); // a fuction to welcome the student who is playing the game and my name is there for the fun of it lol
void Main_Menu(); //asking the user to choose which level they are going to play
int main ()
{
int x;
welcomeScreen();//function call to welcome the players
Main_Menu(); //function call to know the level the player will choose
system("pause");
return 0;
}
void welcomeScreen()//welcome the student who is playing the game and our names and ID numbers
{
printf(" ***** Welcome To Our NEW Jeoparday Game ***** \n\n");
printf(" Shouq - Q8toy \n\n");
}
void Main_Menu() //asking the user to choose which level they are going to play
{
int z;
int score=0; //when we start the game the score is equl to zero
printf("\n --- Please choose one of the following --- \n");
printf("Difficulty level:\n");
printf("1: Simple\n");
printf("2: Intermediate\n");
printf("3: Diffecult\n");
scanf("%d",&z);
if (z==1) //if the use chose the simple level
{
printf("***** You have chosen level 1 ***** \n");
simple(score);
}
else if (z==2) //if the use chose the intermediate level
{
printf("***** You have chosen level 2 *****\n");
Intermediate(score);
}
else if (z==3) //if the use chose the difficult level
{
printf("**** You have chosen level 3 ***** \n");
Difficult( score);
}
else
printf("chose number of the above. Error!");
}
void simple(int score)
{
int b;
int r;
int k;
int m;
printf("Your Score is : %d\n",score);
printf("\n1.What color is the water (5 points)\n"); //the first question
printf("1) No color\n2) Blue\n3) White\n"); //the ansers for the first question
scanf("%d",&b);
score = 0;
if (b==1) // when the user chooses the first answer
{
printf("The answer is correct\n"); // the answer is correct
score=score+5; // increment 5 points to the score
printf("Your Score is : %d\n", score); // print the score on the screen
}
else if (b==2) // when the user chooses the second answer
{
printf("The answer is incorrect\n"); // the answer is wrong
score=score-5; // dicrement 5 points to the score
if (score<=0) // if the score after dicrementing is less than or equal to zero
{
score=0; // make the secore equal to zero
printf("Your Score is : %d\n", score); // print the score on the screen
}
else // if the score after dicrementing is neither less than zero or equal to it
{
printf("Your Score is : %d\n", score); // then just print the score after we decreminted 5 points of it
}
}
else // when (b==3) which means when the user chooses the third answer
{
printf("The answer is incorrect\n"); // the answer is wrong
score=score-5; // dicrement 5 points to the score
if (score<=0) // if the score after dicrementing is less than or equal to zero
{
score=0; // make the secore equal to zero
printf("Your Score is : %d\n", score); // print the score on the screen
}
else // if the score after dicrementing is neither less than zero or equal to it
{
printf("Your Score is : %d\n", score); // then just print the score after we decreminted 5 points of it
}
}
////////////////////////////////////////////
printf("\n2. What is the long form of the word AUM?(10 points)\n");//the second question
printf("1)American University of the Middle east \n2)Amercian Univesity of Kuwait\n3)Amercian Univesity\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is correct\n");
score=score+10;
printf("Your Score is : %d\n", score);
}
else if (b==2)
{
printf("The answer is incorrect\n");
score=score-10;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (b==3)
{
printf("The answer is incorrect\n");
score=score-10;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n3. What is the color of the old Kuwaiti flaq?(15 points)\n");//the 3rd question
printf("1) Red\n2) White\n3) Black\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is correct\n");
score=score+15;
printf("Your Score is : %d\n", score);
}
else if (b==2)
{
printf("The answer is incorrect\n");
score=score-15;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (b==3)
{
printf("The answer is incorrect\n");
score=score-15;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}}
////////////////////////////////////////////
printf("\n4. How many gates are there in AUM?(20 points)\n");//the 4th question
printf("1) 4 gates\n2) 5 gates\n3) 6 gates\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is incorrect\n");
score=score-20;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (b==2)
{
printf("The answer is correct\n");
score=score+20;
printf("Your Score is : %d\n", score);
}
else // (b==3)
{
printf("The answer is incorrect\n");
score=score-20;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n5. What does CS in CS159 refer to?(25 points)\n");//the 5th question
printf("1) Computer Application\n2) Computer Science\n3) Computer Problem\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is incorrect\n");
score=score-25;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}}
else if (b==3)
{
printf("The answer is incorrect\n");
score=score-25;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (b==2)
{
printf("The answer is correct\n");
score=score+25;
printf("Your Score is : %d\n", score);
}
////////////////////////////////////////////
printf("\n6. What is the most common cell phone brand here in Kuwait?(30 points)\n");//the 6th question
printf("1) Nokia\n2) Samsung galaxy\n3) Apple iphone\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is incorrect\n");
score=score-30;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (b==2)
{
printf("The answer is incorrect\n");
score=score-30;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is correct\n");
score=score+30;
printf("Your Score is : %d\n", score);
}
////////////////////////////////////////////
printf("\n7. What is Shouq's name in Japanese =) ?(35 points)\n");//the 7th question
printf("1) ショーク\n2) ショーグ\n3) シュルーグ\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is incorrect\n");
score=score-35;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (b==2)
{
printf("The answer is correct\n");
score=score+35;
printf("Your Score is : %d\n", score);
}
else // (b==3)
{
printf("The answer is incorrect\n");
score=score-35;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n8. What is the capital of Egypt?(40 points)\n");//the 8th question
printf("1) Cairo\n2) Tokyo\n3) Kuwait\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is correct\n");
score=score+40;
printf("Your Score is : %d\n", score);
}
else if (b==2)
{
printf("The answer is incorrect\n");
score=score-40;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (b==3)
{
printf("The answer is incorrect\n");
score=score-40;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n9. What are the colors of Japan flag?(45 points)\n");//the 9th question
printf("1) Red and blue\n2) Red and green\n3) Red and white\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is incorrect\n");
score=score-45;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (b==2)
{
printf("The answer is incorrect\n");
score=score-45;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (b==3)
{
printf("The answer is correct\n");
score=score+45;
printf("Your Score is : %d\n", score);
}
////////////////////////////////////////////
printf("\n10. Arabic has the same writting system as which language?(50 points)\n");//the 10th question
printf("1) Chinese\n2) Japaanese\n3) Urdu\n");
scanf("%d", &b);
if (b==1)
{
printf("The answer is incorrect\n");
score=score-50;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (b==2)
{
printf("The answer is incorrect\n");
score=score-50;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (b==3)
{
printf("The answer is correct\n");
score=score+50;
printf("Your Score is : %d\n", score);
}
printf("\nYou reached the end of the game!\n");
printf("Your Score is : %d\n",score);
printf("\nWould you like to save your score so far to disk?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&r);
if (r==1)
{
FILE *fp1;
fp1=fopen("score.txt","a");
fprintf(fp1,"%d\n",score);
fclose(fp1);
}
printf("\nWould you like to see your previous scores?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&k);
if (k==1)
{
FILE *fp1;
fp1=fopen("score.txt","r");
if (fp1==NULL)
{
printf("ERROR");
}
else
{
while ( (fscanf(fp1,"%d",&score)!= EOF) )
{
printf("\nScore: %d \n",score);
}
}
fclose(fp1);
}
printf("\nWould you like to start another play session?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&m);
if (m==1)
{
score=0;
simple(score);
}
}
void Intermediate( int score)
{
int a;
int r;
int k;
int m;
printf("your Score is: %d\n",score);
printf("\n1. Ph.D. stands for what??(5 points)\n");//the first question
printf("1) Philosophy of Doctor\n2) Doctor of Philosophy\n3) Philosophy of Doctorate\n");//the ansers for the first question
scanf("%d",&a);
score =0;
if (a==1) // when the user chooses the first answer
{
printf("The answer is incorrect\n");// the answer is wrong
score=score-5;// dicrement 5 points to the score
if ( score <= 0)// if the score after dicrementing is less than or equal to zero
{
score=0;// make the secore equal to zero
printf("Your Score is : %d\n",score);// print the score on the screen
}
else // if the score after dicrementing is neither less than zero or equal to it
{
printf("Your Score is : %d\n",score);//then just print the score after we decremented 5 points of it
}
}
else if (a==2) // when the user chooses the second answer
{
printf("The answer is correct\n"); // the answer is correct
score = score + 5; // increment 5 points to the score
printf("Your Score is : %d\n",score); // increment 5 points to the score
}
else //when (b==3) which means when the user chooses the third answer
{
printf("The answer is incorrect\n");// the answer is wrong
score=score-5;// dicrement 5 points to the score
if (score <= 0)// if the score after dicrementing is less than or equal to zero
{
score = 0;// make the secore equal to zero
printf("Your Score is : %d\n",score);// print the score on the screen
}
else // if the score after dicrementing is neither less than zero or equal to it
{
printf("your Score is : %d\n",score); // then just print the score after we decreminted 5 points of it
}
}
/////////////////////////////////////////////
printf("\n2. CV stands for what?(10 points)\n");//the second question
printf("1)Capacity Vitae losers \n2)Curriculum Vitae \n3)Curriculum Vata\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-10;
if ( score <= 0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is correct\n");
score = score + 10;
printf("Your Score is : %d\n",score);
}
else//(a==3)
{
printf("The answer is incorrect\n");
score=score-10;
if (score <= 0)
{
score = 0;
printf("Your Score is : %d\n",score);
}
else
{
printf("your Score is : %d\n",score);
}
}
/////////////////////////////////////////////
printf("\n3. An establishment where money can be deposited or withdrawn is called what?(15 points)\n");//the 3rd question
printf("1)Fridge \n2)Bank \n3)Market \n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-15;
if ( score <= 0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is correct\n");
score = score + 15;
printf("Your Score is : %d\n",score);
}
else//(a==3)
{
printf("The answer is incorrect\n");
score=score-15;
if (score <= 0)
{
score = 0;
printf("Your Score is : %d\n",score);
}
else
{
printf("your Score is : %d\n",score);
}
}
///////////////////////////////////
printf("\n4. What is Shouq's major? lol(20 points)\n");//the 4th question
printf("1)Engineering \n2)Linguistic\n3)Literature\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is correct\n");
score=score+20;
printf("Your Score is : %d\n",score);
}
else if (a==2)
{
printf("The answer is incorrect\n");
score=score-20;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else // (a==3)
{
printf("The answer is incorrect\n");
score=score-20;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
///////////////////////////////////////////
printf("\n5. What is the capital of the UAE?(25 points)\n");//the 5th question
printf("1)Dubai \n2)Abu Dhabi \n3)Sharja\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-25;
if ( score <= 0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is correct\n");
score = score + 25;
printf("Your Score is : %d\n",score);
}
else//(a==3)
{
printf("The answer is incorrect\n");
score=score-25;
if (score <= 0)
{
score = 0;
printf("Your Score is : %d\n",score);
}
else
{
printf("your Score is : %d\n",score);
}
}
////////////////////////////////////
printf("\n6. What is the largest city in the UAE?(30 points)\n");//the 6th question
printf("1)Abu Dhabi \n2)Dubai \n3)Sharja\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-30;
if ( score <= 0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is correct\n");
score = score + 30;
printf("Your Score is : %d\n",score);
}
else//(a==3)
{
printf("The answer is incorrect\n");
score=score-30;
if (score <= 0)
{
score = 0;
printf("Your Score is : %d\n",score);
}
else
{
printf("your Score is : %d\n",score);
}
}
////////////////////////////////////
printf("\n7. JLPT stands for what?(35 points)\n");//the 7th question
printf("1)Japanese Language Proficiency Test \n2)Japanese Language Professional Test \n3)Japanese Linguistic Professional Test\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is correct\n");
score=score+35;
printf("Your Score is : %d\n",score);
}
else if (a==2)
{
printf("The answer is incorrect\n");
score=score-35;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else // (a==3)
{
printf("The answer is incorrect\n");
score=score-35;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
///////////////////////////////////////////?
printf("\n8. What is alopicia?(40 points)\n");//the 8th question
printf("1)A disorder related to blood cells\n2)A disorder related to the strength of muscles \n3)A disorder related to hair\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-40;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is incorrect\n");
score=score-40;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else // (a==3)
{
printf("The answer is correct\n");
score=score+40;
printf("Your Score is : %d\n",score);
}
////////////////////////////////////
printf("\n9. How many eyes does the bee has?(45 points)\n");//the 9th question
printf("1)One eye\n2)Two eyes \n3)Three eyes\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-45;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is incorrect\n");
score=score-45;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else // (a==3)
{
printf("The answer is correct\n");
score=score+45;
printf("Your Score is : %d\n",score);
}
////////////////////////////////////
printf("\n10. How many mountains are three in Kuwait?(50 points)\n");//the 10th question
printf("1)Lots of mountains\n2)Few mountains\n3)No mountain at all\n");
scanf("%d",&a);
if (a==1)
{
printf("The answer is incorrect\n");
score=score-50;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else if (a==2)
{
printf("The answer is incorrect\n");
score=score-50;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n",score);
}
else
{
printf("Your Score is : %d\n",score);
}
}
else // (a==3)
{
printf("The answer is correct\n");
score=score+50;
printf("Your Score is : %d\n",score);
}
printf("\nYou reached the end of the game!\n");
printf("Your Score is : %d\n", score);
printf("\nWould you like to save your score so far to disk?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&r);
if (r==1)
{
FILE *fp1;
fp1=fopen("score.txt","a");
fprintf(fp1,"%d\n",score);
fclose(fp1);
}
printf("\nWould you like to see your previous scores?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&k);
if (k==1)
{
FILE *fp1;
fp1=fopen("score.txt","r");
if (fp1==NULL)
{
printf("ERROR");
}
else
{
while ( (fscanf(fp1,"%d",&score)!= EOF) )
{
printf("\nScore: %d \n",score);
}
}
fclose(fp1);
}
printf("\nWould you like to start another play session?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&m);
if (m==1)
{
score=0;
Intermediate(score);
}
}
void Difficult(int score)
{
int c;
int r;
int k;
int m;
printf("Your Score is : %d\n", score);
printf("\n1.how many writing systems are there in Japanese language?(5 points)\n");//the first question
printf("1) 3 writing systems\n2) 4 writing systems\n3) 2 writing systems\n");//the ansers for the first question
scanf("%d", &c);
score = 0;
if (c==1)// when the user chooses the first answer
{
printf("The answer is correct\n");// the answer is correct
score=score+5;// increment 5 points to the score
printf("Your Score is : %d\n", score);// print the score on the screen
}
else if (c==2)// when the user chooses the second answer
{
printf("The answer is incorrect\n");// the answer is wrong
score=score-5;// dicrement 5 points to the score
if (score<=0)// if the score after dicrementing is less than or equal to zero
{
score=0 ;// make the secore equal to zero
printf("Your Score is : %d\n", score);// print the score on the screen
}
else // if the score after dicrementing is neither less than zero or equal to it
{
printf("Your Score is : %d\n", score);// then just print the score after we decreminted 5 points of it
}
}
else // when (b==3) which means when the user chooses the third answer
{
printf("The answer is incorrect\n");// the answer is wrong
score=score-5;// dicrement 5 points to the score
if (score<=0) // if the score after dicrementing is less than or equal to zero
{
score=0;// make the secore equal to zero
printf("Your Score is : %d\n", score);// print the score on the screen
}
else // if the score after dicrementing is neither less than zero or equal to it
{
printf("Your Score is : %d\n", score);// then just print the score after we decreminted 5 points of it
}
}
////////////////////////////////////////////
printf("\n2. how many heart the octopus has?(10 points)\n");//the second question
printf("1) 3 hearts\n2) 4 hearts\n3) 2 hearts\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is correct\n");
score=score+10;
printf("Your Score is : %d\n", score);
}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-10;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is incorrect\n");
score=score-10;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n3. who used the fork first?(15 points)\n");//the 3rd question
printf("1) French people\n2) Italian people\n3) British people\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is correct\n");
score=score+15;
printf("Your Score is : %d\n", score);
}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-15;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is incorrect\n");
score=score-15;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n4. what is the oldest language that is still used?(20 points)\n");//the 4th question
printf("1) Koran language\n2) Chinese language\n3) Japanese language\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is incorrect\n");
score=score-20;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (c==2)
{
printf("The answer is correct\n");
score=score+20;
printf("Your Score is : %d\n", score);
}
else // (c==3)
{
printf("The answer is incorrect\n");
score=score-20;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n5. how many muscles are there in the human body?(25 points)\n");//the 5th question
printf("1) 400 muscles\n2) 200 muscles\n3) 620 muscles\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is incorrect\n");
score=score-25;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-25;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is correct\n");
score=score+25;
printf("Your Score is : %d\n", score);
}
////////////////////////////////////////////
printf("\n6. for which of the following disciplines is Nobel Prize awarded?(30 points)\n");//the 6th question
printf("1) physic and chemistry\n2) Literature and Economics\n3) All of the above\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is incorrect\n");
score=score-30;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-30;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is correct\n");
score=score+30;
printf("Your Score is : %d\n", score);
}
////////////////////////////////////////////
printf("\n7. Hitler party which came into power in 1933 is known as?(35 points)\n");//the 7th question
printf("1) Labour party\n2) Nazi party\n3) Ku-klux-klan\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is incorrect\n");
score=score-35;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (c==2)
{
printf("The answer is correct\n");
score=score+35;
printf("Your Score is : %d\n", score);
}
else // (c==3)
{
printf("The answer is incorrect\n");
score=score-35;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n8. DRDL stands for?(40 points)\n");//the 8th question
printf("1) Defense Research and Development Laboratory\n2) Department of Research and Development Laboratory\n3) Differential Research and Documentation Laboratory\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is correct\n");
score=score+40;
printf("Your Score is : %d\n", score);
}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-40;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is incorrect\n");
score=score-40;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
////////////////////////////////////////////
printf("\n9. How many states are there in America?(45 points)\n");//the 9th question
printf("1) 60 states\n2) 150 states\n3) 50 states\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is incorrect\n");
score=score-45;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-45;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is correct\n");
score=score+45;
printf("Your Score is : %d\n", score);
}
////////////////////////////////////////////
printf("\n10. what color is the water in the Blue Nile?(50 points)\n");//the 10th question
printf("1) blue\n2) white\n3) colorless\n");
scanf("%d", &c);
if (c==1)
{
printf("The answer is incorrect\n");
score=score-50;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else if (c==2)
{
printf("The answer is incorrect\n");
score=score-50;
if (score<=0)
{
score=0;
printf("Your Score is : %d\n", score);
}
else
{
printf("Your Score is : %d\n", score);
}
}
else // (c==3)
{
printf("The answer is correct\n");
score=score+50;
printf("Your Score is : %d\n", score);
}
printf("\nYou reached the end of the game!\n");
printf("Your Score is : %d\n", score);
printf("\nWould you like to save your score so far to disk?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&r);
if (r==1)
{
FILE *fp1;
fp1=fopen("score.txt","a");
fprintf(fp1,"%d\n",score);
fclose(fp1);
}
printf("\nWould you like to see your previous scores?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&k);
if (k==1)
{
FILE *fp1;
fp1=fopen("score.txt","r");
if (fp1==NULL)
{
printf("ERROR");
}
else
{
while ( (fscanf(fp1,"%d",&score)!= EOF) )
{
printf("\nScore: %d \n",score);
}
}
fclose(fp1);
}
printf("\nWould you like to start another play session?\n");
printf("1: YES\n2: NO\n");
scanf("%d",&m);
if (m==1)
{
score=0;
Difficult(score);
}
}