system(cls); my $loop=1; @one=(NMS,Hydrogen,Helium,Lithium,Beryllium,Boron,Carbon,Nitrogen,Oxygen,Fluorine,Neon,Sodium,Magnesium,Aluminium,Silicon,Phosphorus,Sulfur,Chlorine,Argon,Potassium,Calcium,Scandium,Titanium,Vanadium,Chromium,Manganese,Iron,Cobalt,Nickel,Copper,Zinc); @two=(SYM,H,He,Li,Be,B,C,N,O,F,Ne,Na,Mg,Al,Si,P,S,Cl,Ar,K,Ca,Sc,Ti,V,Cr,Mn,Fe,Co,Ni,Cu,Zn); my $ans; while ($loop==1) { $rand=int(rand(30))+1; $rand2=int(rand(3))+1; $rand3=int(rand(2))+1; if ($rand2==1) { print "Atomic Number: $rand\n"; if ($rand3==1) { print "Give Me Element Name\n"; chomp($ans=<>); if ($ans eq "/hint") {print "@two[$rand]\n";print "Give Me Element Name\n"; chomp($ans=<>);} if ($ans eq @one[$rand]) {print "correct\n"} else {print "Incorrect: Correct answer is ". @one[$rand]."\n";} } if ($rand3==2) { print "Give Me Element Symbol\n"; chomp($ans=<>); if ($ans eq "/hint") {print "@one[$rand]\n";print "Give Me Element Symbol\n"; chomp($ans=<>);} if ($ans eq @two[$rand]) {print "correct\n"} else {print "Incorrect: Correct answer is ". @two[$rand]."\n";} } } if ($rand2==2) { print "Element Name: @one[$rand]\n"; if ($rand3==1) { print "Give Me Element Number\n"; chomp($ans=<>); if ($ans eq "/hint") {print "@two[$rand]\n";print "Give Me Element Number\n"; chomp($ans=<>);} if ($ans eq $rand) {print "correct\n"} else {print "Incorrect: Correct answer is $rand\n"} } if ($rand3==2) { print "Give Me Element Symbol\n"; chomp($ans=<>); if ($ans eq "/hint") {print "$rand\n";print "Give Me Element Symbol\n"; chomp($ans=<>);} if ($ans eq @two[$rand]) {print "correct\n"} else {print "Incorrect: Correct answer is ". @two[$rand]."\n";} } } if ($rand2==3) { print "Element Symbol: @two[$rand]\n"; if ($rand3==1) { print "Give Me Element Number\n"; chomp($ans=<>); if ($ans eq "/hint") {print "@one[$rand]\n";print "Give Me Element Number\n"; chomp($ans=<>);} if ($ans eq $rand) {print "correct\n"} else {print "Incorrect: Correct answer is $rand\n"} } if ($rand3==2) { print "Give Me Element Name\n"; chomp($ans=<>); if ($ans eq "/hint") {print "$rand\n";print "Give Me Element Name\n"; chomp($ans=<>);} if ($ans eq @one[$rand]) {print "correct\n"} else {print "Incorrect: Correct answer is ". @one[$rand]."\n";} } } }