i got no idea how to correct the error,can help me?
this is a chem quiz that contain 20 question but i need to random everytime 10 question,other than this,also have a calculator,& mini games

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<windows.h>

int main (void)
{
	int option,question,i,count,z=0;
	char choice,game,quit;
	int selection;
	float pressure,volume,number_of_mol,temperature;
	int exit;
	char answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8,answer9,answer10,answer11,answer12,answer13,answer14,answer15,answer16,answer17,answer18,answer19,answer20;
	int guess,jackpot=8;
		

	//
	SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_BLUE);
	printf("WELCOME TO CHEMY'S CHEMISTRY");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_RED BACKGROUND_INTENSITY);
	printf("\nMAIN MENU\n");
	printf("*********\n\n");

	printf("Please select option: \n");
	printf("[1]CHEMISTRY QUIZ\n");
	printf("[2]IDEAL GAS LAW CALCULATOR\n");
	printf("[3]OPTIONAL GAME");
	printf("\n\n[0]Exit\n\n");
	
	printf("Please select your menu : ");
	scanf_s("%d", &option);

	if(option == 1)
	{
	system("cls");
	  
		printf("\n\nThis is a CHEMISTRY QUIZ\n");
		printf("**********************\n\n");
		printf("Do you want to start now(Y/N) ");
	    scanf_s("%c",&choice);

		if(choice=='y')

			{
					


					//
					 system("cls");

                    printf("\n+++++++++++++++++++++++++++++++++\n");
					printf("+WELCOME TO CHEMISTRY QUIZ WORLD+\n");
					printf("+++++++++++++++++++++++++++++++++\n");

					srand ( time(NULL) );
					for (int i=0;i<=10;i++);
					{
					question= rand () %20 + 1;
					printf("\n%d",i+1);
					
					system("cls");

					printf("\tQ1. A gas occupies 40.0 mL at 127 oC. What volume will it occupy at -73 oC? (Assume pressure and number of particles is constant.)  ");
					 
					printf("A.182 mL\n B. 8.80 mL\n C.80.0 mL\n D.20.0 mL");


					scanf_s("%c",&answer1);
						if(answer1 =='c')
						{
						printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
						}
						else
		
							
							if(answer1 =='b')					
							{				
							printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
							}
							else

								if(answer1 =='c')							
								{
								printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
								}
								else
							

										if(answer1 =='d')						
										{
										printf("CORRECT ");
										}
										else

										{
											printf("Sorry,incorrect input");
										}





					//
					system("cls");

					printf("\tQ2. A syringe contains 60.0 mL of air at 740 mm Hg pressure and 20 oC. What would be the temperature at which the syringe would contain 30.0 mL at a pressure of 370 mm Hg? (Assume no gas could leak in or out of the syringe. \n");

					printf("A. -200 oC  \n B. 0.0137 oC \n C. 5 oC \n D. 73.3 oC");
					scanf_s("%c",&answer2);

					if(answer2=='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer2 =='b')					
							{				
							printf("Nope.You made an algebra mistake and forgot to convert your answer back to degrees Celsius");
							}
							else

								if(answer2 =='c')							
								{
								printf("Nope.Do not use 20 degrees Celsius-remember to convert to Kelvins.");
								}
								else
							

										if(answer2 =='d')						
										{
										printf("Nope.Your answer is correct in Kelvins-subtract by 273 to convert to Celsius");
										}
										else

										{
											printf("Sorry,incorrect input");
										}



					//
					system("cls");

					printf("\tQ3.The volume of a gas collected over water is 15.0 mL when the atmospheric pressure is 101.3 KPa. What will be the volume of the gas if the atmospheric pressure increases to 120.0 KPa. Assume that the vapor pressure of water is 2.7 KPa and that the temperature is constant. \n");

					printf("A. 0.338mL  \n B. 12.3mL \n C. 12.6mL \n D. 12.9mL");
					scanf_s("%c",&answer3);

					if(answer3=='a')
						{
						printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
						}
						else
		
							
							if(answer3 =='b')					
							{				
							printf("\tNope.You must subtract the vapour pressure of water from the atmospheric pressure");
							}
							else

								if(answer3 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer3 =='d')						
										{
										printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


					//
					system("cls");

					printf("\tQ4.A syringe contains 60.0 mL of air at 740 mm Hg pressure and 20 oC. What would be the temperature at which the syringe would contain 30.0 mL at a pressure of 370 mm Hg? (Assume no gas could leak in or out of the syringe. \n");

					printf("A. -200oC  \n B. 0.0137oC \n C. 5oC \n D. 73.3oC");
					scanf_s("%c",&answer4);

					if(answer4 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer4 =='b')					
							{				
							printf("Nope.You made an algebra mistake and forhot to convert your answer back to degree Celcius.");
							}
							else

								if(answer4 =='c')							
								{
								printf("Nope.Do not use 20 degree Celcius-remeber to convert to Kelvins.");
								}
								else
							

										if(answer4 =='d')						
										{
										printf("Nope.Yor answer is correct in Kelvins-subtract by 273 to convert to Celcius.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}



					//
					system("cls");

					printf("\tQ5.What would happen if aqueous solutions of sodium nitrate and ammonium chloride were mixed?  \n");

					printf("A. A precipitate of soidum chloride would form.  \n B. A precipitate of ammonium chloride would form. \n C.Precipitates of sodium chloride and ammonium chloride would form. \n D.No reaction.");
					scanf_s("%c",&answer5);

					if(answer5 =='a')
						{
						printf("Nope.Sodium Chloride is soluble");
						}
						else
		
							
							if(answer5 =='b')					
							{				
							printf("Nope.Ammonium chloride is soluble.");
							}
							else

								if(answer5 =='c')							
								{
								printf("Nope.Neither would form");
								}
								else
							

										if(answer5 =='d')						
										{
										printf("Nope.Yor answer is correct in Kelvins-subtract by 273 to convert to Celcius.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


					//
					system("cls");

					printf("\tQ6.A compound is 40.0 % carbon, 53.3 % oxygen, and 6.66 % hydrogen. What is its empirical formula? \n");

					printf("A. C4O5H7 \n B. C1O2H3 \n C.C1O1H2l \n D.More than one could be the correct empirical formula.");
					scanf_s("%c",&answer6);

					if(answer6 =='a')
						{
						printf("Nope.You must divide the percent by the molar mass and then look for the smallest whole number ratio.");
						}
						else
		
							
							if(answer6 =='b')					
							{				
							printf("Nope.You might hae forgotten the molar mass for carbon and oxygen reversed");
							}
							else

								if(answer6 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer6 =='d')						
										{
										printf("Nope");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


					//
					system("cls");

					printf("\tQ7.A container of negligible mass is filled first with argon and then with helium. Which statement below would be true about the masses of the two gases (after adjustment for the buoyant effect of air?  \n");

					printf("A. The mass of the helium would be 1/9th that of argon. \n B. C1O2H3The mass of the helium would be 1/10th that of argon. \n C.The mass of helium would be 9x that of argon. \n D.The mass of helium would be 10x that of argon.");
					scanf_s("%c",&answer7);

					if(answer7 =='a')
						{
						printf("Nope.You are confusing atomic numbers and aromic masses.");
						}
						else
		
							
							if(answer7 =='b')					
							{				
							printf("CORRECT");
							}
							else

								if(answer7 =='c')							
								{
								printf("Nope.Helium is lighter than carbon");
								}
								else
							

										if(answer7 =='d')						
										{
										printf("Nope.Helium is lighter than carbon");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


//
					system("cls");

					printf("\tQ8.\t\t\tCH4 (g) + 2 O2 (g) CO2 (g) + 2 H2O (g) + 810 KJ  \n");
					printf("In the reaction above, 3 moles of CH4 could produce how many moles of H2O? ");
					printf("A. 1/2 mol H2O \n B. 2mol H2O \n C.6mol H2O \n D.5 mol H2O");
					scanf_s("%c",&answer8);

					if(answer8 =='a')
						{
						printf("Nope.");
						}
						else
		
							
							if(answer8 =='b')					
							{				
							printf("Nope");
							}
							else

								if(answer8 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer8 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


				//
					system("cls");

					printf("\tQ9.A 4.0 L sample of hydrogen gas at 700 mm Hg would occupy what volume at 250 mm Hg? (Assume temperature and number of particles stays constant.  \n");

					printf("A. 1.4 x 10^-7 L \n B. 1.4L \n C.11.2L \n D.2.4L");
					scanf_s("%c",&answer9);

					if(answer9 =='a')
						{
						printf("Nope.Remember that P1 x V1=P2 x V2");
						}
						else
		
							
							if(answer9 =='b')					
							{				
							printf("Nope.Remember that P1 x V1=P2 x V2");
							}
							else

								if(answer9 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer9 =='d')						
										{
										printf("Nope.Remember that P1 x V1=P2 x V2");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


//
					system("cls");

					printf("\tQ10.How many moles are there in 2.4 x 10 24 atoms of He?  \n");

					printf("A. 2.4 x 10^24 mol \n B.4.0 mol \n C.2.0 mol \n D.6.0 mol");
					scanf_s("%c",&answer10);

					if(answer10 =='a')
						{
						printf("Nope.Remember that there are 6.02E 23 atoms in one mole");
						}
						else
		
							
							if(answer10 =='b')					
							{				
							printf("CORRECT");
							}
							else

								if(answer10 =='c')							
								{
								printf("Nope.Remember that there are 6.02E 23 atoms in one mole");
								}
								else
							

										if(answer10 =='d')						
										{
										printf("Nope.Remember that there are 6.02E 23 atoms in one mole");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


//
					system("cls");

					printf("\tQ11.A compound contains 6.0 g of cabon and 1.0 g of hydrogen. The percent composition of the compound is:   \n");

					printf("A. 14 % hydrogen and 86 % carbon \n B.86 % hydrogen and 14 % carbon \n C.17 % hydrogen and 83 % carbon \n D.83 % hydrogen and 17 % carbon");
					scanf_s("%c",&answer11);

					if(answer11 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer11 =='b')					
							{				
							printf("Nope.Your percents are backwards");
							}
							else

								if(answer11 =='c')							
								{
								printf("Nope.The compound has a total mass of 7.0g,not 6.0g");
								}
								else
							

										if(answer11 =='d')						
										{
										printf("Nope.Your percents are backwards and the total mass of the compound is 7.0g");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

//
					system("cls");

					printf("\tQ11.Which of the following substances would likely dissolve in water: \n");

					printf("A. Zn(NO3)2 \n B.AgCl\n C.NaOH \n D.More than one of above would be dissolve in water.\n");


					scanf_s("%c",&answer12);

					if(answer12 =='a')
						{
						printf("This is correct,but not the only one answer");
						}
						else
		
							
							if(answer12 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer12 =='c')							
								{
								printf("This is correct,but not the only one answer");
								}
								else
							

										if(answer12 =='d')						
										{
										printf("CORRECT");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

//
					system("cls");

					printf("\tQ13.A 63.0 g piece of aluminum (Specific Heat = 0.215 cal / (g oC) ) at 25.0 oC is warmed by the addition of 325 calories of energy. Find the final tempearture of the aluminum \n");

					printf("A. 49.0oC \n B.240oC \n C.26.1 oC\n D.1.11oC\n");


					scanf_s("%c",&answer13);

					if(answer13 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer13 =='b')					
							{				
							printf("Nope.Remember you started at 25 degree Celcius");
							}
							else

								if(answer13 =='c')							
								{
								printf("Nope.Set up the problem so that units cancel correctly");
								}
								else
							

										if(answer13 =='d')						
										{
										printf("Nope.Set up the problem so that units cancel correctly and add 25 degree Celcius to your answer");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

//
					system("cls");

					printf("\tQ14.If 4 moles of a gas are added to a continer that already holds 1 mole of gas, how will the pressure change within the container? (Assume volume and temperature are constant.) \n");

					printf("A. 49.0 oC \n B.240oC \n C.26.1 oC\n D.1.11oC\n");


					scanf_s("%c",&answer14);

					if(answer14 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer14 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer14 =='c')							
								{
								printf("Nope.1+4=5,therefore the pressure will be 5x as great");
								}
								else
							

										if(answer14 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

		//
					system("cls");

					printf("\tQ15. A sealed container contains 1.0 mol of hydrogen and 2.0 moles of nitrogen gas. If the total pressure in the container is 1.5 atm, what is the amount of pressure exerted by each gas? \n");

					printf("A.H2 = 1.0 atm and N2 = .50 atm \n B.H2 = 0.50 atm and N2 = 1.0 atm \n C.H2 = 1.0 atm and N2 = 2.0 atm \n D.H2 = 2.0 atm and N2 = 1.0 atm\n");


					scanf_s("%c",&answer15);

					if(answer15 =='a')
						{
						printf("Nope.There are not as many mplecules of hydrogen,so they will not contribute to most of the pressure.");
						}
						else
		
							
							if(answer15 =='b')					
							{				
							printf("CORRECT.");
							}
							else

								if(answer15 =='c')							
								{
								printf("Nope.he total pressure is not 3.0atm");
								}
								else
							

										if(answer15 =='d')						
										{
										printf("Nope.he total pressure is not 3.0atm");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

				//
					system("cls");

					printf("\tQ16.  A sample of gas is collected by water displacement. The atmospheric pressure in the room is 757 mm Hg and the vapor pressure of water is 17 mm Hg. What is the partial pressure of hydrogen under these conditions?  \n");

					printf("A.17 mm Hg \n B.740 mm Hg \n C.757 mm Hg \n D.H2 =774 mm Hg\n");


					scanf_s("%c",&answer16);

					if(answer16 =='a')
						{
						printf("Nope.This is the pressure exerted as water molecules evaporate into the gas container");
						}
						else
		
							
							if(answer16 =='b')					
							{				
							printf("CORRECT! P total= P water + P hydrogen");
							}
							else

								if(answer16 =='c')							
								{
								printf("Nope.The total pressure--757 mmHg is equal to the pressure of wate plus the pressure of the hydrogen,You need to do a subtraction");
								}
								else
							

										if(answer16 =='d')						
										{
										printf("Nope.P total= P water + P hydrogen");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

					//
					system("cls");

					printf("\tQ17. 15 g of NaCl occupy a volume of 75 mL. What is the molarity of the solution?   \n");

					printf("A.3.4M \n B.0.29 M \n C.0.019M \n D.0.0034M\n");


					scanf_s("%c",&answer17);

					if(answer17 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer17 =='b')					
							{				
							printf("Nope.Molarity is moles per liter ,not liters per mole.");
							}
							else

								if(answer17 =='c')							
								{
								printf("Nope.Make sure that your units cancel to give moles per liter.");
								}
								else
							

										if(answer17 =='d')						
										{
										printf("Nope.Use liters,not mililiters");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

						//
					system("cls");

					printf("\tQ18. In the reaction given in problem 5, 80.0 mL of 2.0 M HCl would react with how many grams of aluminum? \n");

					printf("A.1.44g \n B.4.32g \n C.1440g \n D.2030g\n");


					scanf_s("%c",&answer18);

					if(answer18 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer17 =='b')					
							{				
							printf("Nope.Do not forget to use mole ratio.");
							}
							else

								if(answer17 =='c')							
								{
								printf("Nope.Did you forget to change milliliters to liters.");
								}
								else
							

										if(answer17 =='d')						
										{
										printf("Nope.Cancel your units properly");
										}
										else

										{
											printf("Sorry,incorrect input");
										}
	//
					system("cls");

					printf("\tQ18.When a hydrocarbon undergoes complete combustion the products are: \n");

					printf("A.carbon dioxide and water \n B.carbon dioxide and hydrogen \n C.carbon dioxide and oxygen \n D.carbon and hydrogen\n");


					scanf_s("%c",&answer18);

					if(answer18 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer18 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer18 =='c')							
								{
								printf("Nope.");
								}
								else
							

										if(answer18 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}
			//
					system("cls");

					printf("\tQ19.In the reaction above, the production 5.0 x 10 24 molecules of H2O would result in how many moles of CO2?  \n");
			
					printf("A.0.060 mol CO2 \n B.0.24 mol CO2 \n C.4.2 mol CO2 \n D.16.6 mol CO2\n");


					scanf_s("%c",&answer19);

					if(answer19 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer19 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer19 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer19 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

										//
					system("cls");

					printf("\tQ20.In the reaction above, the production 5.0 x 10 24 molecules of H2O would result in how many moles of CO2?  \n");
			
					printf("A.0.56 g / L \n B.1.78 g / L \n C.22.4 g / L \n D.40. g / L\n");


					scanf_s("%c",&answer20);

					if(answer20 =='a')
						{
						printf("Nope.Your units do not cancel to give out g/L.");
						}
						else
		
							
							if(answer20 =='b')					
							{				
							printf("CORRECT.");
							}
							else

								if(answer20 =='c')							
								{
								printf("This is the number of liters in a mole at STP");
								}
								else
							

										if(answer20 =='d')						
										{
										printf("This is molar mass of argon.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}
			}

			else
			if(choice=='n');

			{
				return main();
			}

	
 }

	else
	if(option == 2)
		{

		system("cls");

		printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
		printf("@                                            @\n");
		printf("@      ********************************      @\n");
		printf("@      *** IDEAL GAS LAW CALCULATOR ***      @\n");
		printf("@      ********************************      @\n");
		printf("@                                            @\n");
		printf("@                 MAIN MENU                  @\n");
		printf("@                                            @\n");
		printf("@   1.PRESSURE                               @\n");
		printf("@   2.VOLUME                                 @\n");
		printf("@   3.NUMBER OF MOL                          @\n");
		printf("@   4.TEMPERATURE                            @\n");
		printf("@                                            @\n");
		printf("@   0.EXIT                                   @\n");
		printf("@                                            @\n");
		printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");



		printf("Please choose your menu : ");

		scanf_s("%d", &selection);

				if (selection==1)

				{
					system("cls");

					printf("***********************************************************************");
					printf("*                        IDEAL GAS LAW<PRESSURE>                      *");
					printf("***********************************************************************\n\n\n");


					printf("Please key in the Volume:");
					scanf_s("%f",&volume);

					printf("Please key in the number of mol:\n");
					scanf_s("%f",&number_of_mol);

					printf("Please key in the temperature:");
					scanf_s("%f",&temperature);
					 
					return main();

					//
					pressure=(float)(number_of_mol*0.082057*temperature)/volume;


					//
					printf("Pressure --> %.4f\n\n",pressure);

					main();

					}




				else
					if (selection==2)

				{
					system("cls");

					//
					printf("****************************************************************************************\n");
					printf("*                              IDEAL GAS LAW<VOLUME>                                   *\n");
					printf("****************************************************************************************\n\n\n");


					printf("Please key in the Pressure:\n");
					scanf_s("%f",&pressure);

					printf("Please key in the number of mol:\n");
					scanf_s("%f",&number_of_mol);

					printf("Please key in the temperature:");
					scanf_s("%f",&temperature);


					//
					volume=(float)(number_of_mol*0.082057*temperature)/pressure;


					//
					printf("Volume --> %f",volume);

				main();
			  
					}


					else
					if (selection==3)

				{
					system("cls");

					//
					printf("****************************************************************************************\n");
					printf("*                              IDEAL GAS LAW<NUMBER OF MOL>                            *\n");
					printf("****************************************************************************************\n\n\n");


					printf("Please key in the Pressure:\n");
					scanf_s("%f",&pressure);

					printf("Please key in the Volume:\n");
					scanf_s("%f",&number_of_mol);

					printf("Please key in the temperature:");
					scanf_s("%f",&temperature);


					//
					number_of_mol=(float)((pressure*volume)/(0.082057*temperature));


					//
					printf("Number of mol --> %f",number_of_mol);

				main();
			  
					}


				else
				if (selection==4)

				{
					system("cls");

					//
					printf("****************************************************************************************\n");
					printf("*                              IDEAL GAS LAW<TEMPERATURE>                              *\n");
					printf("****************************************************************************************\n\n\n");


					printf("Please key in the Pressure:\n");
					scanf_s("%f",&pressure);

					printf("Please key in the Volume:\n");
					scanf_s("%f",&volume);

					printf("Please key in the No of mol:");
					scanf_s("%f",&number_of_mol);


					//
					temperature=(float)((pressure*volume)/(0.082057*number_of_mol));


					//
					printf("Temperature --> %f",temperature);

				main();
			  
					}

						
				else
				if(selection==0)
				{
					system("cls");
					printf("Are you sure you want to exit? (1/0): ");
					scanf_s("%d",&exit);

					if(exit==1)
					{
						return 0;
					}	
					else
					{
						main();
					}

				}

				else
				{
					printf("I'm sorry,but you have enter an inavalid selection.Please try again");
				}	
				
		





else
if(option ==3)
		

	{
			 system("cls");

		printf("*******************\n");
		printf("***Optional Game***\n");
		printf("*******************\n");



		printf("Would you want to continue? (Y/N): ");
		if(game=='y')
		{
			printf("Try to guess the jackpot number \nbetweern 1 and 10!\n");
			printf("Please type a number. \n");
			scanf("%d",&guess);

			if(guess<jackpot)
				printf("Try a bigger number\n");
			if(guess>jackpot)
				printf("Try a smaller number\n");
			
			if(guess==jackpot)
				printf("Verify your guess by typing it one more time\n");

				scanf("%d",&guess);

			if(guess==jackpot)
			{
				printf("You hit the \n");
				SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED);
				printf("JACKPOT");
			}

			if(guess!=jackpot)
				printf("You have not guessed correctly. \nYou lose. \n");
		}





		}


	else
	if(option==0)

			{
		
			system("cls");
			printf("Are you sure you want to exit? (Y/N): ");
			scanf_s("%c",&quit);
				if(quit=='y')
				{
					printf("Thank you for using this program!!\n");
					printf("The program will be terminated\n\n");
				}
				else
				{
					main();
				}
			}
	else
		
		{
			printf("I'm sorry,but you have enter an inavalid selection.Please try again");
	    }
return 0;
}


a lot of error,but i really blur,pls help me

error C2143: syntax error : missing ')' before 'constant'
error C2059: syntax error : ')'
warning C4244: 'function' : conversion from 'time_t' to 'unsigned int', possible loss of data
error C2143: syntax error : missing ';' before 'type'
error C2143: syntax error : missing ';' before 'type'
error C2143: syntax error : missing ')' before 'type'
error C2143: syntax error : missing ';' before 'type'
warning C4552: '<=' : operator has no effect; expected operator with side-effect
error C2059: syntax error : ')'
error C2181: illegal else without matching if
error C2181: illegal else without matching if
fatal error C1075: end of file found before the left brace '{' at 'c

Edited 4 Years Ago by angelineang: forget to put error

I am sure whay this have many problem,
if you want to know what problem you got, you have to have an organized code.

see this example I organized it for you see before and after.

Before

//
					system("cls");

					printf("\tQ4.A syringe contains 60.0 mL of air at 740 mm Hg pressure and 20 oC. What would be the temperature at which the syringe would contain 30.0 mL at a pressure of 370 mm Hg? (Assume no gas could leak in or out of the syringe. \n");

					printf("A. -200oC  \n B. 0.0137oC \n C. 5oC \n D. 73.3oC");
					scanf_s("%c",&answer4);

					if(answer4 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer4 =='b')					
							{				
							printf("Nope.You made an algebra mistake and forhot to convert your answer back to degree Celcius.");
							}
							else

								if(answer4 =='c')							
								{
								printf("Nope.Do not use 20 degree Celcius-remeber to convert to Kelvins.");
								}
								else
							

										if(answer4 =='d')						
										{
										printf("Nope.Yor answer is correct in Kelvins-subtract by 273 to convert to Celcius.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

After

//
				system("cls");

				printf("\tQ3.The volume of a gas collected over water is 15.0 mL when the atmospheric pressure is 101.3 KPa. What will be the volume of the gas if the atmospheric pressure increases to 120.0 KPa. Assume that the vapor pressure of water is 2.7 KPa and that the temperature is constant. \n");

				printf("A. 0.338mL  \n B. 12.3mL \n C. 12.6mL \n D. 12.9mL");
				scanf_s("%c",&answer3);

				if(answer3=='a')
				{
					printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else if(answer3 =='b')					
				{				
					printf("\tNope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else if(answer3 =='c')							
				{
					printf("CORRECT");
				}
				else if(answer3 =='d')						
				{
					printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else
				{
					printf("Sorry,incorrect input");
				}

I may reply more if I get a solution

char answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8,answer9,answer10,answer11,answer12,answer13,answer14,answer15,answer16,answer17,answer18,answer19,answer20;

you should use

answer[20] 
//or
answer[21]

Edited 4 Years Ago by Ab000dy_85: n/a

Ok I organized small part and you can follow my lead,

then after you finish organizing it, I can help

Here is the code

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<windows.h>

int main (void)
{
	int option,question,i,count,z=0;
	char choice,game,quit;
	int selection;
	float pressure,volume,number_of_mol,temperature;
	int exit;
	char answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8,answer9,answer10,answer11,answer12,answer13,answer14,answer15,answer16,answer17,answer18,answer19,answer20;
	int guess,jackpot=8;
		

	//
	SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_BLUE);
	printf("WELCOME TO CHEMY'S CHEMISTRY");
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_RED | BACKGROUND_INTENSITY);
	printf("\nMAIN MENU\n");
	printf("*********\n\n");

	printf("Please select option: \n");
	printf("[1]CHEMISTRY QUIZ\n");
	printf("[2]IDEAL GAS LAW CALCULATOR\n");
	printf("[3]OPTIONAL GAME");
	printf("\n\n[0]Exit\n\n");
	
	printf("Please select your menu : ");
	scanf("%d", &option);

	if(option == 1)
	{
		system("cls");

		printf("\n\nThis is a CHEMISTRY QUIZ\n");
		printf("**********************\n\n");
		printf("Do you want to start now(Y/N) ");
	    scanf_s("%c",&choice);

		if(choice=='y')

		{
			int i;

			system("cls");

            printf("\n+++++++++++++++++++++++++++++++++\n");
			printf("+WELCOME TO CHEMISTRY QUIZ WORLD+\n");
			printf("+++++++++++++++++++++++++++++++++\n");

			srand ( time(NULL) );
			for ( i=0;i<=10;i++)
			{
				question= rand () %20 + 1;
				printf("\n%d",i+1);
					
				system("cls");

				printf("\tQ1. A gas occupies 40.0 mL at 127 oC. What volume will it occupy at -73 oC? (Assume pressure and number of particles is constant.)  ");
					 
				printf("A.182 mL\n B. 8.80 mL\n C.80.0 mL\n D.20.0 mL");


				scanf_s("%c",&answer1);
				if(answer1 =='c')
				{
					printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
				}
				else if(answer1 =='b')					
				{				
					printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
				}
				else if(answer1 =='c')							
				{
					printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
				}
				else if(answer1 =='d')						
				{
					printf("CORRECT ");
				}
				else
				{
					printf("Sorry,incorrect input");
				}





					//
				system("cls");

				printf("\tQ2. A syringe contains 60.0 mL of air at 740 mm Hg pressure and 20 oC. What would be the temperature at which the syringe would contain 30.0 mL at a pressure of 370 mm Hg? (Assume no gas could leak in or out of the syringe. \n");

				printf("A. -200 oC  \n B. 0.0137 oC \n C. 5 oC \n D. 73.3 oC");
				scanf_s("%c",&answer2);

				if(answer2=='a')
				{
					printf("CORRECT");
				}
				else if(answer2 =='b')					
				{				
					printf("Nope.You made an algebra mistake and forgot to convert your answer back to degrees Celsius");
				}
				else if(answer2 =='c')							
				{
					printf("Nope.Do not use 20 degrees Celsius-remember to convert to Kelvins.");
				}
				else if(answer2 =='d')						
				{
					printf("Nope.Your answer is correct in Kelvins-subtract by 273 to convert to Celsius");
				}
				else
				{
					printf("Sorry,incorrect input");
				}



				//
				system("cls");

				printf("\tQ3.The volume of a gas collected over water is 15.0 mL when the atmospheric pressure is 101.3 KPa. What will be the volume of the gas if the atmospheric pressure increases to 120.0 KPa. Assume that the vapor pressure of water is 2.7 KPa and that the temperature is constant. \n");

				printf("A. 0.338mL  \n B. 12.3mL \n C. 12.6mL \n D. 12.9mL");
				scanf_s("%c",&answer3);

				if(answer3=='a')
				{
					printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else if(answer3 =='b')					
				{				
					printf("\tNope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else if(answer3 =='c')							
				{
					printf("CORRECT");
				}
				else if(answer3 =='d')						
				{
					printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else
				{
					printf("Sorry,incorrect input");
				}


				//
				system("cls");

				printf("\tQ4.A syringe contains 60.0 mL of air at 740 mm Hg pressure and 20 oC. What would be the temperature at which the syringe would contain 30.0 mL at a pressure of 370 mm Hg? (Assume no gas could leak in or out of the syringe. \n");

				printf("A. -200oC  \n B. 0.0137oC \n C. 5oC \n D. 73.3oC");
				scanf_s("%c",&answer4);

				if(answer4 =='a')
				{
					printf("CORRECT");
				}
				else if(answer4 =='b')					
				{				
					printf("Nope.You made an algebra mistake and forhot to convert your answer back to degree Celcius.");
				}
				else if(answer4 =='c')							
				{
					printf("Nope.Do not use 20 degree Celcius-remeber to convert to Kelvins.");
				}
				else if(answer4 =='d')						
				{
					printf("Nope.Yor answer is correct in Kelvins-subtract by 273 to convert to Celcius.");
				}
				else
				{
					printf("Sorry,incorrect input");
				}



					//
					system("cls");

					printf("\tQ5.What would happen if aqueous solutions of sodium nitrate and ammonium chloride were mixed?  \n");

					printf("A. A precipitate of soidum chloride would form.  \n B. A precipitate of ammonium chloride would form. \n C.Precipitates of sodium chloride and ammonium chloride would form. \n D.No reaction.");
					scanf_s("%c",&answer5);

					if(answer5 =='a')
						{
						printf("Nope.Sodium Chloride is soluble");
						}
						else
		
							
							if(answer5 =='b')					
							{				
							printf("Nope.Ammonium chloride is soluble.");
							}
							else

								if(answer5 =='c')							
								{
								printf("Nope.Neither would form");
								}
								else
							

										if(answer5 =='d')						
										{
										printf("Nope.Yor answer is correct in Kelvins-subtract by 273 to convert to Celcius.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


					//
					system("cls");

					printf("\tQ6.A compound is 40.0 % carbon, 53.3 % oxygen, and 6.66 % hydrogen. What is its empirical formula? \n");

					printf("A. C4O5H7 \n B. C1O2H3 \n C.C1O1H2l \n D.More than one could be the correct empirical formula.");
					scanf_s("%c",&answer6);

					if(answer6 =='a')
						{
						printf("Nope.You must divide the percent by the molar mass and then look for the smallest whole number ratio.");
						}
						else
		
							
							if(answer6 =='b')					
							{				
							printf("Nope.You might hae forgotten the molar mass for carbon and oxygen reversed");
							}
							else

								if(answer6 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer6 =='d')						
										{
										printf("Nope");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


					//
					system("cls");

					printf("\tQ7.A container of negligible mass is filled first with argon and then with helium. Which statement below would be true about the masses of the two gases (after adjustment for the buoyant effect of air?  \n");

					printf("A. The mass of the helium would be 1/9th that of argon. \n B. C1O2H3The mass of the helium would be 1/10th that of argon. \n C.The mass of helium would be 9x that of argon. \n D.The mass of helium would be 10x that of argon.");
					scanf_s("%c",&answer7);

					if(answer7 =='a')
						{
						printf("Nope.You are confusing atomic numbers and aromic masses.");
						}
						else
		
							
							if(answer7 =='b')					
							{				
							printf("CORRECT");
							}
							else

								if(answer7 =='c')							
								{
								printf("Nope.Helium is lighter than carbon");
								}
								else
							

										if(answer7 =='d')						
										{
										printf("Nope.Helium is lighter than carbon");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


//
					system("cls");

					printf("\tQ8.\t\t\tCH4 (g) + 2 O2 (g) CO2 (g) + 2 H2O (g) + 810 KJ  \n");
					printf("In the reaction above, 3 moles of CH4 could produce how many moles of H2O? ");
					printf("A. 1/2 mol H2O \n B. 2mol H2O \n C.6mol H2O \n D.5 mol H2O");
					scanf_s("%c",&answer8);

					if(answer8 =='a')
						{
						printf("Nope.");
						}
						else
		
							
							if(answer8 =='b')					
							{				
							printf("Nope");
							}
							else

								if(answer8 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer8 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


				//
					system("cls");

					printf("\tQ9.A 4.0 L sample of hydrogen gas at 700 mm Hg would occupy what volume at 250 mm Hg? (Assume temperature and number of particles stays constant.  \n");

					printf("A. 1.4 x 10^-7 L \n B. 1.4L \n C.11.2L \n D.2.4L");
					scanf_s("%c",&answer9);

					if(answer9 =='a')
						{
						printf("Nope.Remember that P1 x V1=P2 x V2");
						}
						else
		
							
							if(answer9 =='b')					
							{				
							printf("Nope.Remember that P1 x V1=P2 x V2");
							}
							else

								if(answer9 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer9 =='d')						
										{
										printf("Nope.Remember that P1 x V1=P2 x V2");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


//
					system("cls");

					printf("\tQ10.How many moles are there in 2.4 x 10 24 atoms of He?  \n");

					printf("A. 2.4 x 10^24 mol \n B.4.0 mol \n C.2.0 mol \n D.6.0 mol");
					scanf_s("%c",&answer10);

					if(answer10 =='a')
						{
						printf("Nope.Remember that there are 6.02E 23 atoms in one mole");
						}
						else
		
							
							if(answer10 =='b')					
							{				
							printf("CORRECT");
							}
							else

								if(answer10 =='c')							
								{
								printf("Nope.Remember that there are 6.02E 23 atoms in one mole");
								}
								else
							

										if(answer10 =='d')						
										{
										printf("Nope.Remember that there are 6.02E 23 atoms in one mole");
										}
										else

										{
											printf("Sorry,incorrect input");
										}


//
					system("cls");

					printf("\tQ11.A compound contains 6.0 g of cabon and 1.0 g of hydrogen. The percent composition of the compound is:   \n");

					printf("A. 14 % hydrogen and 86 % carbon \n B.86 % hydrogen and 14 % carbon \n C.17 % hydrogen and 83 % carbon \n D.83 % hydrogen and 17 % carbon");
					scanf_s("%c",&answer11);

					if(answer11 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer11 =='b')					
							{				
							printf("Nope.Your percents are backwards");
							}
							else

								if(answer11 =='c')							
								{
								printf("Nope.The compound has a total mass of 7.0g,not 6.0g");
								}
								else
							

										if(answer11 =='d')						
										{
										printf("Nope.Your percents are backwards and the total mass of the compound is 7.0g");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

//
					system("cls");

					printf("\tQ11.Which of the following substances would likely dissolve in water: \n");

					printf("A. Zn(NO3)2 \n B.AgCl\n C.NaOH \n D.More than one of above would be dissolve in water.\n");


					scanf_s("%c",&answer12);

					if(answer12 =='a')
						{
						printf("This is correct,but not the only one answer");
						}
						else
		
							
							if(answer12 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer12 =='c')							
								{
								printf("This is correct,but not the only one answer");
								}
								else
							

										if(answer12 =='d')						
										{
										printf("CORRECT");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

//
					system("cls");

					printf("\tQ13.A 63.0 g piece of aluminum (Specific Heat = 0.215 cal / (g oC) ) at 25.0 oC is warmed by the addition of 325 calories of energy. Find the final tempearture of the aluminum \n");

					printf("A. 49.0oC \n B.240oC \n C.26.1 oC\n D.1.11oC\n");


					scanf_s("%c",&answer13);

					if(answer13 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer13 =='b')					
							{				
							printf("Nope.Remember you started at 25 degree Celcius");
							}
							else

								if(answer13 =='c')							
								{
								printf("Nope.Set up the problem so that units cancel correctly");
								}
								else
							

										if(answer13 =='d')						
										{
										printf("Nope.Set up the problem so that units cancel correctly and add 25 degree Celcius to your answer");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

//
					system("cls");

					printf("\tQ14.If 4 moles of a gas are added to a continer that already holds 1 mole of gas, how will the pressure change within the container? (Assume volume and temperature are constant.) \n");

					printf("A. 49.0 oC \n B.240oC \n C.26.1 oC\n D.1.11oC\n");


					scanf_s("%c",&answer14);

					if(answer14 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer14 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer14 =='c')							
								{
								printf("Nope.1+4=5,therefore the pressure will be 5x as great");
								}
								else
							

										if(answer14 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

		//
					system("cls");

					printf("\tQ15. A sealed container contains 1.0 mol of hydrogen and 2.0 moles of nitrogen gas. If the total pressure in the container is 1.5 atm, what is the amount of pressure exerted by each gas? \n");

					printf("A.H2 = 1.0 atm and N2 = .50 atm \n B.H2 = 0.50 atm and N2 = 1.0 atm \n C.H2 = 1.0 atm and N2 = 2.0 atm \n D.H2 = 2.0 atm and N2 = 1.0 atm\n");


					scanf_s("%c",&answer15);

					if(answer15 =='a')
						{
						printf("Nope.There are not as many mplecules of hydrogen,so they will not contribute to most of the pressure.");
						}
						else
		
							
							if(answer15 =='b')					
							{				
							printf("CORRECT.");
							}
							else

								if(answer15 =='c')							
								{
								printf("Nope.he total pressure is not 3.0atm");
								}
								else
							

										if(answer15 =='d')						
										{
										printf("Nope.he total pressure is not 3.0atm");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

				//
					system("cls");

					printf("\tQ16.  A sample of gas is collected by water displacement. The atmospheric pressure in the room is 757 mm Hg and the vapor pressure of water is 17 mm Hg. What is the partial pressure of hydrogen under these conditions?  \n");

					printf("A.17 mm Hg \n B.740 mm Hg \n C.757 mm Hg \n D.H2 =774 mm Hg\n");


					scanf_s("%c",&answer16);

					if(answer16 =='a')
						{
						printf("Nope.This is the pressure exerted as water molecules evaporate into the gas container");
						}
						else
		
							
							if(answer16 =='b')					
							{				
							printf("CORRECT! P total= P water + P hydrogen");
							}
							else

								if(answer16 =='c')							
								{
								printf("Nope.The total pressure--757 mmHg is equal to the pressure of wate plus the pressure of the hydrogen,You need to do a subtraction");
								}
								else
							

										if(answer16 =='d')						
										{
										printf("Nope.P total= P water + P hydrogen");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

					//
					system("cls");

					printf("\tQ17. 15 g of NaCl occupy a volume of 75 mL. What is the molarity of the solution?   \n");

					printf("A.3.4M \n B.0.29 M \n C.0.019M \n D.0.0034M\n");


					scanf_s("%c",&answer17);

					if(answer17 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer17 =='b')					
							{				
							printf("Nope.Molarity is moles per liter ,not liters per mole.");
							}
							else

								if(answer17 =='c')							
								{
								printf("Nope.Make sure that your units cancel to give moles per liter.");
								}
								else
							

										if(answer17 =='d')						
										{
										printf("Nope.Use liters,not mililiters");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

						//
					system("cls");

					printf("\tQ18. In the reaction given in problem 5, 80.0 mL of 2.0 M HCl would react with how many grams of aluminum? \n");

					printf("A.1.44g \n B.4.32g \n C.1440g \n D.2030g\n");


					scanf_s("%c",&answer18);

					if(answer18 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer17 =='b')					
							{				
							printf("Nope.Do not forget to use mole ratio.");
							}
							else

								if(answer17 =='c')							
								{
								printf("Nope.Did you forget to change milliliters to liters.");
								}
								else
							

										if(answer17 =='d')						
										{
										printf("Nope.Cancel your units properly");
										}
										else

										{
											printf("Sorry,incorrect input");
										}
	//
					system("cls");

					printf("\tQ18.When a hydrocarbon undergoes complete combustion the products are: \n");

					printf("A.carbon dioxide and water \n B.carbon dioxide and hydrogen \n C.carbon dioxide and oxygen \n D.carbon and hydrogen\n");


					scanf_s("%c",&answer18);

					if(answer18 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer18 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer18 =='c')							
								{
								printf("Nope.");
								}
								else
							

										if(answer18 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}
			//
					system("cls");

					printf("\tQ19.In the reaction above, the production 5.0 x 10 24 molecules of H2O would result in how many moles of CO2?  \n");
			
					printf("A.0.060 mol CO2 \n B.0.24 mol CO2 \n C.4.2 mol CO2 \n D.16.6 mol CO2\n");


					scanf_s("%c",&answer19);

					if(answer19 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer19 =='b')					
							{				
							printf("Nope.");
							}
							else

								if(answer19 =='c')							
								{
								printf("CORRECT");
								}
								else
							

										if(answer19 =='d')						
										{
										printf("Nope.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

										//
					system("cls");

					printf("\tQ20.In the reaction above, the production 5.0 x 10 24 molecules of H2O would result in how many moles of CO2?  \n");
			
					printf("A.0.56 g / L \n B.1.78 g / L \n C.22.4 g / L \n D.40. g / L\n");


					scanf_s("%c",&answer20);

					if(answer20 =='a')
						{
						printf("Nope.Your units do not cancel to give out g/L.");
						}
						else
		
							
							if(answer20 =='b')					
							{				
							printf("CORRECT.");
							}
							else

								if(answer20 =='c')							
								{
								printf("This is the number of liters in a mole at STP");
								}
								else
							

										if(answer20 =='d')						
										{
										printf("This is molar mass of argon.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}
			}

			if(choice=='n')
			{
				return 0;
			}

	
 }

	else
	if(option == 2)
		{

		system("cls");

		printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
		printf("@                                            @\n");
		printf("@      ********************************      @\n");
		printf("@      *** IDEAL GAS LAW CALCULATOR ***      @\n");
		printf("@      ********************************      @\n");
		printf("@                                            @\n");
		printf("@                 MAIN MENU                  @\n");
		printf("@                                            @\n");
		printf("@   1.PRESSURE                               @\n");
		printf("@   2.VOLUME                                 @\n");
		printf("@   3.NUMBER OF MOL                          @\n");
		printf("@   4.TEMPERATURE                            @\n");
		printf("@                                            @\n");
		printf("@   0.EXIT                                   @\n");
		printf("@                                            @\n");
		printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");



		printf("Please choose your menu : ");

		scanf_s("%d", &selection);

				if (selection==1)

				{
					system("cls");

					printf("***********************************************************************");
					printf("*                        IDEAL GAS LAW<PRESSURE>                      *");
					printf("***********************************************************************\n\n\n");


					printf("Please key in the Volume:");
					scanf_s("%f",&volume);

					printf("Please key in the number of mol:\n");
					scanf_s("%f",&number_of_mol);

					printf("Please key in the temperature:");
					scanf_s("%f",&temperature);
					 
					return main();

					//
					pressure=(float)(number_of_mol*0.082057*temperature)/volume;


					//
					printf("Pressure --> %.4f\n\n",pressure);


					}




				else
					if (selection==2)

				{
					system("cls");

					//
					printf("****************************************************************************************\n");
					printf("*                              IDEAL GAS LAW<VOLUME>                                   *\n");
					printf("****************************************************************************************\n\n\n");


					printf("Please key in the Pressure:\n");
					scanf_s("%f",&pressure);

					printf("Please key in the number of mol:\n");
					scanf_s("%f",&number_of_mol);

					printf("Please key in the temperature:");
					scanf_s("%f",&temperature);


					//
					volume=(float)(number_of_mol*0.082057*temperature)/pressure;


					//
					printf("Volume --> %f",volume);

			  
					}


					else
					if (selection==3)

				{
					system("cls");

					//
					printf("****************************************************************************************\n");
					printf("*                              IDEAL GAS LAW<NUMBER OF MOL>                            *\n");
					printf("****************************************************************************************\n\n\n");


					printf("Please key in the Pressure:\n");
					scanf_s("%f",&pressure);

					printf("Please key in the Volume:\n");
					scanf_s("%f",&number_of_mol);

					printf("Please key in the temperature:");
					scanf_s("%f",&temperature);


					//
					number_of_mol=(float)((pressure*volume)/(0.082057*temperature));


					//
					printf("Number of mol --> %f",number_of_mol);

			  
					}


				else
				if (selection==4)

				{
					system("cls");

					//
					printf("****************************************************************************************\n");
					printf("*                              IDEAL GAS LAW<TEMPERATURE>                              *\n");
					printf("****************************************************************************************\n\n\n");


					printf("Please key in the Pressure:\n");
					scanf_s("%f",&pressure);

					printf("Please key in the Volume:\n");
					scanf_s("%f",&volume);

					printf("Please key in the No of mol:");
					scanf_s("%f",&number_of_mol);


					//
					temperature=(float)((pressure*volume)/(0.082057*number_of_mol));


					//
					printf("Temperature --> %f",temperature);

			  
					}

						
				else
				if(selection==0)
				{
					system("cls");
					printf("Are you sure you want to exit? (1/0): ");
					scanf_s("%d",&exit);

					if(exit==1)
					{
						return 0;
					}	
					else
					{
						//main();
					}

				}

				else
				{
					printf("I'm sorry,but you have enter an inavalid selection.Please try again");
				}	
				
		





if(option ==3)
		

	{
			 system("cls");

		printf("*******************\n");
		printf("***Optional Game***\n");
		printf("*******************\n");



		printf("Would you want to continue? (Y/N): ");
		if(game=='y')
		{
			printf("Try to guess the jackpot number \nbetweern 1 and 10!\n");
			printf("Please type a number. \n");
			scanf("%d",&guess);

			if(guess<jackpot)
				printf("Try a bigger number\n");
			if(guess>jackpot)
				printf("Try a smaller number\n");
			
			if(guess==jackpot)
				printf("Verify your guess by typing it one more time\n");

				scanf("%d",&guess);

			if(guess==jackpot)
			{
				printf("You hit the \n");
				SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_RED);
				printf("JACKPOT");
			}

			if(guess!=jackpot)
				printf("You have not guessed correctly. \nYou lose. \n");
		}





		}


	else
	if(option==0)

			{
		
			system("cls");
			printf("Are you sure you want to exit? (Y/N): ");
			scanf_s("%c",&quit);
				if(quit=='y')
				{
					printf("Thank you for using this program!!\n");
					printf("The program will be terminated\n\n");
				}
				else
				{
					main();
				}
			}
	else
		
		{
			printf("I'm sorry,but you have enter an inavalid selection.Please try again");
	    }
	}

}
return 0;
}

plus, you have a lot of this stuff:

if(answer1 =='c')
						{
						printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
						}
						else
 
 
							if(answer1 =='b')					
							{				
							printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
							}
							else
 
								if(answer1 =='c')							
								{
								printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
								}
								else
 
 
										if(answer1 =='d')						
										{
										printf("CORRECT ");
										}

change that to:

if ( answer1 == 'd' ) {
        printf ("CORRECT");
    } else {
        printf("Nope.Remember that Charles Law is V1/T1=V2/T2");
    }

once you cleaned up your code, you'll probably see the error yourself. And why isn't the compiler telling you in which lines the errors are?

I am sure whay this have many problem,
if you want to know what problem you got, you have to have an organized code.

see this example I organized it for you see before and after.

Before

//
					system("cls");

					printf("\tQ4.A syringe contains 60.0 mL of air at 740 mm Hg pressure and 20 oC. What would be the temperature at which the syringe would contain 30.0 mL at a pressure of 370 mm Hg? (Assume no gas could leak in or out of the syringe. \n");

					printf("A. -200oC  \n B. 0.0137oC \n C. 5oC \n D. 73.3oC");
					scanf_s("%c",&answer4);

					if(answer4 =='a')
						{
						printf("CORRECT");
						}
						else
		
							
							if(answer4 =='b')					
							{				
							printf("Nope.You made an algebra mistake and forhot to convert your answer back to degree Celcius.");
							}
							else

								if(answer4 =='c')							
								{
								printf("Nope.Do not use 20 degree Celcius-remeber to convert to Kelvins.");
								}
								else
							

										if(answer4 =='d')						
										{
										printf("Nope.Yor answer is correct in Kelvins-subtract by 273 to convert to Celcius.");
										}
										else

										{
											printf("Sorry,incorrect input");
										}

After

//
				system("cls");

				printf("\tQ3.The volume of a gas collected over water is 15.0 mL when the atmospheric pressure is 101.3 KPa. What will be the volume of the gas if the atmospheric pressure increases to 120.0 KPa. Assume that the vapor pressure of water is 2.7 KPa and that the temperature is constant. \n");

				printf("A. 0.338mL  \n B. 12.3mL \n C. 12.6mL \n D. 12.9mL");
				scanf_s("%c",&answer3);

				if(answer3=='a')
				{
					printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else if(answer3 =='b')					
				{				
					printf("\tNope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else if(answer3 =='c')							
				{
					printf("CORRECT");
				}
				else if(answer3 =='d')						
				{
					printf("Nope.You must subtract the vapour pressure of water from the atmospheric pressure");
				}
				else
				{
					printf("Sorry,incorrect input");
				}

I may reply more if I get a solution

pls,excuse me,how to put the randomization,and the highest score list?pls help me...

I dont get what you trying to do?
You want to keep track of high score??
and make the question in a random order?

I dont get what you trying to do?
You want to keep track of high score??
and make the question in a random order?

ya,actually i only wan user to answer 10 question everytime,get the score,store in array,then next time open will not be reset,at there i set 20 question,thus everytime will be random,different question will cum out

So, your program does compile and works, but you want to store the score in a db-file, or something? And you don't know how to use the random function?

Ideally, you want to store all the questions and answers in a db-file, anyway. That way you could reduce all your if-elseif-elseif-elseif and it were easy to scale in case you came up with more questions.

for handling files, check "man open", for using random numbers, check "man random".

If I got you question wrong, please rephrase.

So, your program does compile and works, but you want to store the score in a db-file, or something? And you don't know how to use the random function?

Ideally, you want to store all the questions and answers in a db-file, anyway. That way you could reduce all your if-elseif-elseif-elseif and it were easy to scale in case you came up with more questions.

for handling files, check "man open", for using random numbers, check "man random".

If I got you question wrong, please rephrase.

i dunno how to link this inside my question

srand ( time(NULL) );
for (int i=0;i<=10;i++);
{
question= rand () %20 + 1;
printf("\n%d",i+1);

i really dunno how to store my score for next time reopen this program can still appear all my score previous time,i nid to use array or wat?
wat is man random?n oso man open?

type "man rand" into google and you will find the rand manual page. But obviously, you already know how to use it. If you want to link it with your questions, you can take several approaches. I'd use two char* arrays: char* question[20], answer[20][4], hint[20] and an int array (e.g. int correct[20]). Then you put all questions into question[], all 4 answers in each of answer[], and the correct answers in correct[]. Your write a function to convert chars a-d to 0-4, or use ints to enumerate your answers. And score is a number, of course. Then your program looks like this:

//read last score from a file

for (int round = 0; round < 10; round++ ) {
//generate random number i
//print question,
for (int letter = 0 ; letter < 4; letter++ ) {
// write possible answer[letter]
}
// scan answer
// if given answer equals correct
// print "Correct", score++;
// if not, print hint;
}

// make a remark about this score and the old score.

// write score into a file

remember that arrays start with 0, not with 1, and that you should always initiate variables. Also, lack and careless use of indentation suggests some laziness in asking the question. While you are at it, write the questions, answers, correct answers and questions into a file.

Once everything works, learn how to use simple database-formats and read everything from a db-file. Makes it easier to extend questions, answers and hints and also contribute others to your program.

This whole thing sounds like a homework task. If so: you shouldn't expect others to do your work. If it's not, you should read some C basics, like arrays, switch statements, working with files. Remember that GIYF.

I think you program might be easier to read and modify if you put some part of code in fonction other than main().

for exemple:

void print_main_menu(void) {
  SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE), FOREGROUND_BLUE);
  printf("WELCOME TO CHEMY'S CHEMISTRY");
  SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_RED | BACKGROUND_INTENSITY);
  printf("\nMAIN MENU\n");
  printf("*********\n\n");
 
  printf("Please select option: \n");
  printf("[c]CHEMISTRY QUIZ\n");
  printf("[i]IDEAL GAS LAW CALCULATOR\n");
  printf("[o]OPTIONAL GAME");
  printf("\n\n[0]Exit\n\n");
 
  printf("Please select your menu : ");
}

void get_key(char * key){
  *key = (char)getchar();
}

void main(void) {
  char key = 'r', menu = 0, answer = 0;
  while(key != 'q') {
    switch (key) {
      case 'r':
        print_main_menu();
        break;
      case 'c':
        if(menu == 0) { // if no menu choosen
          launch_chemistry_game();
          menu = key;
        }
        break;
      case 'i':
        if(menu == 0) { // if no menu choosen
          launch_gaz_calculator();
          menu = key;
        }
        break;
      case 'o':
        if(menu == 0) { // if no menu choosen
          launch_optionnam_game();
          menu = key;
        }
        break;
      case '1':
      case '2':
      case '3':
      case '4':
        if(menu == c) { // a chemistry game is launch
          check_chemistry_answer(key);
        }
        break;
    }
    get_key(&key);
  }
}

Nice,

however, create a flag array
Let say,

bool QuestionVisited[21]

then initial all values to false,

and when using random number from 0 to 20
before enering the question check if the QuestionVisited[randValue] == false;

then enter the question and set the QuestionVisited[randValue] = true,

and count++ // which keep track of how many question have been asked.

if the QuestionVisited[randValue] == true, then the question was asked before.
then ignore it and go back again with a new randome value.

evrytime you loop check if the count == 10

if(count == 10)
{
break; // which break u out the loop
}
This article has been dead for over six months. Start a new discussion instead.