Sunday, 10 December 2017

Quiz game to check your fan following In C

#include<stdio.h>
int year(int b);
int main()

//Drama about whom questions are asked from the user is HUMSAFAR.
//A hit serial by HUM-TV
//Different questions are asked from the user
///User inputs the answer
//answers are stored in strings,arrays,pointers,integers
///List of used operators of C-LANGUAGE is below:
//Fuction.
//call by reference(pointers).
//strings.
//switch statements.
//if-else,nested if-else.
//return.
//break statements.
//call by value.
//and(&&) operator.
//1 for yes,0 for no[Truth values]
{
int x,n2,n3;
char n1;
printf("Are you intrested to play FAN FALLOWING:if yes enter 1 if no enter 0");
scanf("%d",&x);
switch(x)


{
case 0:
printf("\n No");
break;
case 1:
printf("\n Yes");
printf("\n Let's play!");
break;


}
if(x==0)
return 0;
else
printf("\n You have to answer following questions to prove yourself fan of HUMSAFAR.");
//Question 1:
printf("\n Q1: What is the name of MAHIRA KHAN in HUMSAFAR?:\n");
printf("\n Now choose the corect answer");
printf("\n 1.HUDA \n 2. SANA \n 3.KHIRAD");
printf("\n Enter first letter of name.");
scanf("%s",&n1);
switch(n1)


{
case 'h':
printf("\n HUDA...NO wrong");
break;
case 's':
printf("\n Sana...No wrong");
break;
case 'k':
printf("\n KHIRAD...You are right");
break;


}
//Question 2:
printf("\n Q2:KHIRAD moved with her MOTHER to KARACHI for what reason?");
printf("\n 1.For good environment. \n 2.Due to the illness of her mother. \n 3.For a trip");
printf("\n Enter :");
scanf("%d",&n2);
if(n2==2)


{
printf("\n Due to the illness of her mother.");
printf("\n You are right.");


}
else
printf("\n Wrong.");
//Question 3:
printf("\n Q3: Who was Asher Hussain?");
printf("\n 1.Khirad's cousin. \n 2.Friend. \n 3.Her father.");
printf("\n Enter: ");
scanf("%d",&n3);
switch(n3)


{
case 1:
printf("\n Khirad's cousin...Yes"); //switch cases to confirm the name
break;
case 2:
printf("\n Friend...No");
break;
case 3:
printf("\n Father? O please No.");
break;


}
char n4,n7;
int n5,*i,n6,a;
printf("\n Q4:Who sang the title song of Humsafar?");
printf("\n 1.Mahnoor Baloch. \n 2.Hadiqa kiyani. \n 3.Quratulain Baloch");
printf("\n Enter First Letter:");
scanf("%s",&n4);
switch(n4)


{
case 'M':
printf("\n Mahnoor Baloch.\n Wrong answer");
break;
case 'H':
printf("\n Hadiqa kiyani.\n Wrong answer");
break;
case 'Q':
printf("\n Quratulain Baloch.\n Yes ");
break;


}
//Question: 5
//By using pointers


i=&n5;
printf("\n Q5:How many times sara(Asher's Cousin) attempted sucide?");
printf("\n 1.One. \n 2.Two. \n 3.Three");
printf("\n Enter a number:");
scanf("%d",&n5);
if(*i==2) //years are saved in pointer p
printf("\n Yes. \n She attempted sucide for two times.");
else
printf("\n No. \n You are wrong.");
//Question: 6
printf("\n Q6:For what reason KHIRAD was supposed to be guilty?");
printf("\n Options are: \n 1.She liked KHIZAR other then ASHER. \n 2.Khirad was theif.");
printf("\n Enter :");
scanf("%d",&n6);
if(n6==1)
printf("\n Yes. \n The right answer.");
else
printf("\n No. \n You are wrong.");
//Question: 7
//using arrays
printf("\n Q7:Who is the writer of the drama?");
printf("\n Options are: \n 1.Umera Ahmed. \n 2.Nimra Ahmed. \n 3.Farhat Ishtiaq.");
printf("\n Enter :");
scanf("%d",&a);



{
if(a==3)
printf("\n Yes. \n Farhat Ishtiaq wrote this fantatistically.");
else
printf("\n No. \n You are wrong.");


}
//Question 8:
int n9, n8;
printf("\n Q8:What is the name of the daughter of Asher and Khirad?");
printf("\n Options are: \n 1.Hareem. \n 2.Maryam. \n 3.Sataish");
printf("\n Enter :");
scanf("%d",&n8);

if(n8==1)


{
printf("\n Yes. \n You are right.");


}
else if(n8==2)


{
printf("\n No. \n Wrong");


}
else
printf("\n Wrong.");



//Question 9:
//Using functions
printf("\n Q9:How many years KHIRAD lived without Asher after the misunderstanding?");
printf("\n 1.Two. \n 2.Three. \n 3.Five.");
printf("\n Enter number:");
scanf("%d",&n9);


year(n9);

}
int year(int b)


{
int n10,n11;
if(b==2)
printf("\n No.");
else if(b==3)
printf("\n No.");
else


{
printf("\n Enter years are %d",b);
printf("\n Yes. \n You are right.");


}
//Question 10:
printf("\n Q10:For what reason KHIRAD compromised?");
printf("\n 1.For no reason. \n 2.Due to the illness of HAREEM.");
printf("\n Enter :");
scanf("%d",&n10);



if(n10==1)
printf("\n No. \n You are wrong");
else
printf("\n Yes right. \n Her daughter was suffering from heart disease.");



//Question 11:
//Strings in switch statements
printf("\n Q11:What doctors suggested Hareem?");
printf("\n 1.Open heart surgery. \n 2.Medicines.");
printf("\n Enter :");
scanf("%d",&n11);
switch(n11)


{
case 1:
printf("\n Yes.");
break;
case 2:
printf("\n No.");
break;


}
int n12,n13,Yes,No;
char n14[20],n15[10],n16[20],F,S,B;
//Question 12:
printf("\n Q12:What was the colour of the dress KHIRAD wearing at the day of HAREEM'S surgery?");
printf("\n 1.Yellow and white. \n 2.Red and white. \n 3.Peach and white.");
printf("\n Enter the colour:");
scanf("%d",&n12);



switch(n12)


{
case 1:
printf("\n No.");
break;
case 2:
printf("\n No.");
break;
case 3:
printf("\n Yes. \n Indeed she's looking gorgeous in that simple dress.");
break;


}
//Question 13:
printf("\n Q13:How the truth revealed to ASHER?");
printf("\n 1.He read the letter of KHIRAD. \n 2.His mother told him the truth.");
printf("\n Enter:");
scanf("%d",&n13);
if(n13==1)


{
printf("\n Yes. \n He read the letter which KHIRAD wrote at the night she was accused guity.");


}
else


{
printf("\n No.");


}
//Question 14:
printf("\n Q14:Where did KHIRAD went after HAREEM'S open heart surgery?");
printf("\n 1.Islamabad. \n 2.Faislabad. \n 3.Hyderabad.");
printf("\n Enter the city:");
scanf("%s",&n14[20]);



if(n14[20]=='I'&&'s'&&'l'&&'a'&&'m'&&'a'&&'b'&&'a'&&'d')


{
printf("\n No.");


n14[20]=1;
}
else if(n14[20]=='F'&&'a'&&'i'&&'s'&&'a'&&'l'&&'a'&&'b'&&'a'&&'d')


{
printf("\n No.");


n14[20]=2;
}
else


{
printf("\n Yes. \n The city nearest to karachi and in the same province as karachi.");


n14[20]=3;
}
//Question 15:
printf("\n Q15:KHIRAD forgave ASHER for not trusting her? ");
printf("\n 1.Yes. \n 2. No");
printf("\n Enter yes or no:");
scanf("%s",&n15[10]);



if(n15[10]=='Y'&&'e'&&'s')
printf("\n True");
else if(n15[10]=='N'&&'o')
printf("\n False.");
else
printf("\n Invalid");
//Question 16:
printf("\n Q16:Who is the director of the fabulous drama?");
printf("\n 1.Fahad Mustafa. \n 2.Sarmad Sultan Khosat. \n 3.Babar javed.");
printf("\n Enter name:");
scanf("%s",&n16[20]);


F=n16[20];
S=n16[20];
B=n16[20];
switch(n16[20])


{
case 'F':
printf("\n No.");
break;
case 'S':
printf("\n Yes. \n He's a fabulous director.");
break;
case 'B':
printf("\n No.");
break;


}
char n1,n4;
int n2,n3,*i,n6,a[20],n8;




//the final fan following prcentage.
if(n1=='k'&&n2==2&&n3==1&&n4=='Q'&&*(i)==2&&n6==1&&a[20]==3&&n8==1&&b==5&&n10==2&&n11==1&&n12==3&&n13==1&&n14[20]==3&&n15[10]=='Y'&&'e'&&'s'&&n16[20]=='S')


{
printf("\n You are 80 percent fan of the drama Humsafar");


}
else if(n1=='k'&&n2==3&&n3==2&&n4=='Q'&&*(i)==1&&n6==1&&a[20]==3&&n8==1&&b==5&&n10==2&&n11==1&&n12==3&&n13==1&&n14[20]==3&&n15[10]=='Y'&&'e'&&'s'&&n16[20]=='S')


{
printf("\n You are 90 percent fan of Humsafar.");


}
else


{
printf("\n You are 100 percent fan of Humsafar");


}
}

 

0 comments:

Post a Comment

Tech UOG