I need to do a chem quiz that contain a science calculator n a small game,but there is some problem,got any idea?
#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