У меня есть проблема с тем, как моя программа работает в dev c++.можете ли вы запустить ее, чтобы определить проблему?
#include <stdio.h> #include <conio.h> #include <iostream.h> int main() { char one,two,three,four,five,six,seven,eight,nine,ten,onee,twoe; int o,t,th,f,fi; int fil,eng,math,sci,ap,tle,mapeh,val,comp,research,adv_bio,ex; float finalgrade,fgfil,fgmath,fgsci,fgap,fgtle,fgmapeh,fgval,fgcomp,fgresearch,fgadv_bio,fgeng,overall; printf("\n\n\t\t\tWelcome to the LK System\n\n\tPlease Choose letter of your desired program\n\na)Brain Games\n\nb)Mindreader\n\nc)Grade Solver\n\n"); scanf("%s",&onee); system("cls"); switch (onee) { case 'a': printf("\n\n\t\t\tWelcome to the Braingames\n\n\nIn this game,Where gonna test how big is your brain.\n\nJust answer the ff questions\n\n\n1.What is the family name of the First President of Russia?\n\na)Putin\t\tc)Yeltsin\n\nb)Medcedev\tYour Answer:\t"); scanf("%s",&one); switch (one) { case 'a': printf("\nYour answer is correct\n"); break; default: printf("\nYour answer is Wrong\n\nCorrect Answer:\tPutin\n"); } printf("\n\n\n2.Who is the Second President of the United States?\n\na)George Washington\t\tc)John Adams\n\nb)Richard Nixon\t\t\tYour Answer:\t"); scanf("%s",&two); switch (two) { case 'c': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer: John Adams\n"); } printf("\n\n\n3.Ramon Magsaysay is the_____ Presdient of the Philippines\n\na)7th\t\tc)9th\n\nb)6th:\t\tYour Answer:\t"); scanf("%s",&three); switch (three) { case 'a': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer: 7th\n"); } printf("\n\n\n4.What is the first cellphone developed by Samsung?\n\na)Mobira Talkman\t\tc)TU 500\n\nb)SH - 100\t\t\tYour Answer:\t"); scanf("%s",&four); switch (four) { case 'b': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer: SH - 100\n"); } printf("\n\n\n5.Which is correct:\n\na)White is the eggyolk\t\tc)None of the above\n\nb)Eggyolk is the white\t\t\tYour Answer:\t"); scanf("%s",&five); switch (five) { case 'c': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tc:\tThe Eggyolk is yellow\n"); } printf("\n\n\n6.Before Mount Everest was discovered,what was The Hightest Mountain of the\tWorld?:\n\na)Mount Fuji\t\tc)Mauna Laua\n\nb)Yellowstone\t\td)None of the Above\t\tYour Answer:\t"); scanf("%s",&six); switch (six) { case 'd': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tnone:\tMount Everest was still the Tallest Mountain\n"); } printf("\n\n\n7.One of the Inventors of the Internet\n\na)Richard Stallman\t\tc)Vint Cerf\n\nb)Ken Thompson\t\t\tYour Answer:\t"); scanf("%s",&seven); switch (seven) { case 'c': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tVint Cerf\n"); } printf("\n\n\n8.Place where the first guns were created\n\na)Russia\t\tc)Japan\n\nb)China\t\t\tYour Answer:\t"); scanf("%s",&eight); switch (eight) { case 'b': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tChina\n"); } printf("\n\n\n9.Can you take a picture with a wooden leg?\n\na)Yes\t\tc)Not sure\n\nb)No\t\tYour Answer:\t"); scanf("%s",&nine); switch (nine) { case 'b': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tNo:You can't take a picture using a wooden leg\n"); } printf("\n\n\n10.Who is the founder of apple?\n\na)Bill Gates\t\tc)Markus Persson\n\nb)Steve Jobbs\t\td)None of the above\tYour Answer:\t"); scanf("%s",&ten); switch (ten) { case 'd': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tNone:\t Steve Jobs is not Steve Jobbs\n"); } { case 'b': printf("Pick a number from 1 to 15. Please enter any key to proceed. 1 = yes and 0 = no"); printf("\n\n\nIs your number here?\n\n3 10 14 15 5 12 4 2 11\n\n\tYour answer:\t"); scanf("%d",&o); printf("\n\n\nIs your number here?\n\n5 9 12 8 1 11 7 3 4\n\n\tYour answer:\t"); scanf("%d",&t); printf("\n\n\nIs your number here?\n\n4 9 6 13 1 15 2 5 12\n\n\tYour answer:\t"); scanf("%d",&th); printf("\n\n\nIs your number here?\n\n7 15 10 9 6 1 5 3 2\n\n\tYour answer:\t"); scanf("%d",&f); printf("\n\n\nIs your number here?\n\n4 8 14 10 13 3 11 7 1 2 6\n\n\tYour answer:\t"); scanf("%d",&fi); { if (o == 0 && t == 1 && th == 1 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 1!!!!!"); if (o == 1 && t == 0 && th == 1 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 2!!!!!"); if (o == 1 && t == 1 && th == 0 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 3!!!!!"); if (o == 1 && t == 1 && th == 1 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 4!!!!!"); if (o == 1 && t == 1 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 5!!!!!"); if (o == 0 && t == 0 && th == 1 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 6!!!!!"); if (o == 0 && t == 1 && th == 0 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 7!!!!!"); if (o == 0 && t == 1 && th == 1 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 8!!!!!"); if (o == 0 && t == 1 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 9!!!!!"); if (o == 1 && t == 0 && th == 0 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 10!!!!!"); if (o == 1 && t == 1 && th == 0 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 11!!!!!"); if (o == 1 && t == 1 && th == 1 && f == 0 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 12!!!!!"); if (o == 0 && t == 0 && th == 1 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 13!!!!!"); if (o == 0 && t == 1 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 14!!!!!"); if (o == 1 && t == 0 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 15!!!!!"); } { case 'c': printf("Enter filipino grade:\t\t"); scanf("%d",&fil); if (fil > 92) printf("\n\n\t\t\t\tTaas ba\n********************************************************************************\n"); if (fil < 92) printf("\n\n\tNubo haw?\n************************************************************************\n"); printf("\nEnter English grade:\t\t"); scanf("%d",&eng); if (eng > 92) printf("\n\n\tYour a genius!\n************************************************************************\n"); if (eng < 92) printf("\n\n\tPinoy tuod\n************************************************************************\n"); printf("\nEnter Math grade:\t\t"); scanf("%d",&math); if (math > 92) printf("\n\n\tEngineer utok ya ba\n************************************************************************\n"); if (math < 92) printf("\n\n\tAhay...\n************************************************************************\n"); printf("\nEnter Science Grade\t\t"); scanf("%d",&sci); if (sci > 92) printf("\n\n\tEinstein maalam\n************************************************************************\n"); if (sci < 92) printf("\n\n\tPalatuon gid man\n************************************************************************\n"); printf("\nEnter Aral Pan grade:\t\t"); scanf("%d",&ap); if (ap > 92) printf("\n\n\tHISTORIAN!!!\n************************************************************************\n"); if (ap < 92) printf("\n\n\t0K lng na\n************************************************************************\n"); printf("\nEnter TlE grade:\t\t"); scanf("%d",&tle); if (tle > 92) printf("\n\n\tNamit luto mo guro ay?\n************************************************************************\n"); if (tle < 92) printf("\n\n\tKulang pa asin luto mo day\n************************************************************************\n"); printf("\nEnter Mapeh grade:\t\t"); scanf("%d",&mapeh); if (mapeh > 92) printf("\n\n\tAlam ka na ah\n************************************************************************\n"); if (mapeh < 92) printf("\n\n\tAmo na lang ni nubo pa?\n************************************************************************\n"); printf("\nEnter Val Ed grade:\t\t"); scanf("%d",&val); if (val > 92) printf("\n\n\tPa Heaven ka na guro bwas\n************************************************************************\n"); if (val < 92) printf("\n\n\tOyyyy bad\n************************************************************************\n"); printf("\nEnter Computer grade:\t\t"); scanf("%d",&comp); if (comp > 92) printf("\n\nMa'am Lacson Jr.\n************************************************************************\n"); if (comp < 92) printf("\n\n\tAlay sa kamot ma type beh mo\n************************************************************************\n"); printf("\nEnter Research grade:\t\t"); scanf("%d",&research); if (research > 92) printf("\t\n\nIkaw na gid ya\n************************************************************************\n"); if (research < 92) printf("\n\n\tWala na ni ya duda ya\n************************************************************************\n"); printf("\nEnter Advance Bio grade:\t"); scanf("%d",&adv_bio); if (adv_bio > 92) printf("\n\n\tScientist\n************************************************************************\n"); if (adv_bio < 92) printf("\n\n\tWala mn ko gni may ma inchindihan sa report\n************************************************************************\n"); printf("\n\n\n\n\n Computing.....1....2....3....4\n\n\n\n"); fgfil = fil * 1.2; fgeng = eng * 1.2; fgmath = math * 1.2; fgsci = sci * 1.2; fgap = ap * 0.9; fgtle = tle * 1.2; fgmapeh = mapeh * 1.2; fgval= val * 0.9; fgcomp = comp * 0.6; fgresearch = research * 0.9; fgadv_bio = adv_bio * 0.9; overall = fgfil + fgeng + fgmath + fgsci + fgap + fgtle + fgmapeh + fgval + fgcomp + fgresearch + fgadv_bio; finalgrade = overall/11.4; system("cls"); printf("\n\n\n\n\n\t\t\tYour final grade is %.3f",finalgrade); if (finalgrade > 92) printf("\n\t\t\tCongrats Honorol ba"); if (finalgrade < 92) printf("\n\t\t\tTuon pa tudo ahh"); } } getch(); } }
Что я уже пробовал:
#include <stdio.h> #include <conio.h> #include <iostream.h> int main() { char one,two,three,four,five,six,seven,eight,nine,ten,onee,twoe; int o,t,th,f,fi; int fil,eng,math,sci,ap,tle,mapeh,val,comp,research,adv_bio,ex; float finalgrade,fgfil,fgmath,fgsci,fgap,fgtle,fgmapeh,fgval,fgcomp,fgresearch,fgadv_bio,fgeng,overall; printf("\n\n\t\t\tWelcome to the LK System\n\n\tPlease Choose letter of your desired program\n\na)Brain Games\n\nb)Mindreader\n\nc)Grade Solver\n\n"); scanf("%s",&onee); system("cls"); switch (onee) { case 'a': printf("\n\n\t\t\tWelcome to the Braingames\n\n\nIn this game,Where gonna test how big is your brain.\n\nJust answer the ff questions\n\n\n1.What is the family name of the First President of Russia?\n\na)Putin\t\tc)Yeltsin\n\nb)Medcedev\tYour Answer:\t"); scanf("%s",&one); switch (one) { case 'a': printf("\nYour answer is correct\n"); break; default: printf("\nYour answer is Wrong\n\nCorrect Answer:\tPutin\n"); } printf("\n\n\n2.Who is the Second President of the United States?\n\na)George Washington\t\tc)John Adams\n\nb)Richard Nixon\t\t\tYour Answer:\t"); scanf("%s",&two); switch (two) { case 'c': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer: John Adams\n"); } printf("\n\n\n3.Ramon Magsaysay is the_____ Presdient of the Philippines\n\na)7th\t\tc)9th\n\nb)6th:\t\tYour Answer:\t"); scanf("%s",&three); switch (three) { case 'a': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer: 7th\n"); } printf("\n\n\n4.What is the first cellphone developed by Samsung?\n\na)Mobira Talkman\t\tc)TU 500\n\nb)SH - 100\t\t\tYour Answer:\t"); scanf("%s",&four); switch (four) { case 'b': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer: SH - 100\n"); } printf("\n\n\n5.Which is correct:\n\na)White is the eggyolk\t\tc)None of the above\n\nb)Eggyolk is the white\t\t\tYour Answer:\t"); scanf("%s",&five); switch (five) { case 'c': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tc:\tThe Eggyolk is yellow\n"); } printf("\n\n\n6.Before Mount Everest was discovered,what was The Hightest Mountain of the\tWorld?:\n\na)Mount Fuji\t\tc)Mauna Laua\n\nb)Yellowstone\t\td)None of the Above\t\tYour Answer:\t"); scanf("%s",&six); switch (six) { case 'd': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tnone:\tMount Everest was still the Tallest Mountain\n"); } printf("\n\n\n7.One of the Inventors of the Internet\n\na)Richard Stallman\t\tc)Vint Cerf\n\nb)Ken Thompson\t\t\tYour Answer:\t"); scanf("%s",&seven); switch (seven) { case 'c': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tVint Cerf\n"); } printf("\n\n\n8.Place where the first guns were created\n\na)Russia\t\tc)Japan\n\nb)China\t\t\tYour Answer:\t"); scanf("%s",&eight); switch (eight) { case 'b': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tChina\n"); } printf("\n\n\n9.Can you take a picture with a wooden leg?\n\na)Yes\t\tc)Not sure\n\nb)No\t\tYour Answer:\t"); scanf("%s",&nine); switch (nine) { case 'b': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tNo:You can't take a picture using a wooden leg\n"); } printf("\n\n\n10.Who is the founder of apple?\n\na)Bill Gates\t\tc)Markus Persson\n\nb)Steve Jobbs\t\td)None of the above\tYour Answer:\t"); scanf("%s",&ten); switch (ten) { case 'd': printf("\n\nYour answer is correct\n"); break; default: printf("\n\nYour answer is Wrong\n\nCorrect Answer:\tNone:\t Steve Jobs is not Steve Jobbs\n"); } { case 'b': printf("Pick a number from 1 to 15. Please enter any key to proceed. 1 = yes and 0 = no"); printf("\n\n\nIs your number here?\n\n3 10 14 15 5 12 4 2 11\n\n\tYour answer:\t"); scanf("%d",&o); printf("\n\n\nIs your number here?\n\n5 9 12 8 1 11 7 3 4\n\n\tYour answer:\t"); scanf("%d",&t); printf("\n\n\nIs your number here?\n\n4 9 6 13 1 15 2 5 12\n\n\tYour answer:\t"); scanf("%d",&th); printf("\n\n\nIs your number here?\n\n7 15 10 9 6 1 5 3 2\n\n\tYour answer:\t"); scanf("%d",&f); printf("\n\n\nIs your number here?\n\n4 8 14 10 13 3 11 7 1 2 6\n\n\tYour answer:\t"); scanf("%d",&fi); { if (o == 0 && t == 1 && th == 1 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 1!!!!!"); if (o == 1 && t == 0 && th == 1 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 2!!!!!"); if (o == 1 && t == 1 && th == 0 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 3!!!!!"); if (o == 1 && t == 1 && th == 1 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 4!!!!!"); if (o == 1 && t == 1 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 5!!!!!"); if (o == 0 && t == 0 && th == 1 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 6!!!!!"); if (o == 0 && t == 1 && th == 0 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 7!!!!!"); if (o == 0 && t == 1 && th == 1 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 8!!!!!"); if (o == 0 && t == 1 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 9!!!!!"); if (o == 1 && t == 0 && th == 0 && f == 1 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 10!!!!!"); if (o == 1 && t == 1 && th == 0 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 11!!!!!"); if (o == 1 && t == 1 && th == 1 && f == 0 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 12!!!!!"); if (o == 0 && t == 0 && th == 1 && f == 0 && fi == 1 ) printf("\n\n\n\t\t\tYour number is 13!!!!!"); if (o == 0 && t == 1 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 14!!!!!"); if (o == 1 && t == 0 && th == 1 && f == 1 && fi == 0 ) printf("\n\n\n\t\t\tYour number is 15!!!!!"); } { case 'c': printf("Enter filipino grade:\t\t"); scanf("%d",&fil); if (fil > 92) printf("\n\n\t\t\t\tTaas ba\n********************************************************************************\n"); if (fil < 92) printf("\n\n\tNubo haw?\n************************************************************************\n"); printf("\nEnter English grade:\t\t"); scanf("%d",&eng); if (eng > 92) printf("\n\n\tYour a genius!\n************************************************************************\n"); if (eng < 92) printf("\n\n\tPinoy tuod\n************************************************************************\n"); printf("\nEnter Math grade:\t\t"); scanf("%d",&math); if (math > 92) printf("\n\n\tEngineer utok ya ba\n************************************************************************\n"); if (math < 92) printf("\n\n\tAhay...\n************************************************************************\n"); printf("\nEnter Science Grade\t\t"); scanf("%d",&sci); if (sci > 92) printf("\n\n\tEinstein maalam\n************************************************************************\n"); if (sci < 92) printf("\n\n\tPalatuon gid man\n************************************************************************\n"); printf("\nEnter Aral Pan grade:\t\t"); scanf("%d",&ap); if (ap > 92) printf("\n\n\tHISTORIAN!!!\n************************************************************************\n"); if (ap < 92) printf("\n\n\t0K lng na\n************************************************************************\n"); printf("\nEnter TlE grade:\t\t"); scanf("%d",&tle); if (tle > 92) printf("\n\n\tNamit luto mo guro ay?\n************************************************************************\n"); if (tle < 92) printf("\n\n\tKulang pa asin luto mo day\n************************************************************************\n"); printf("\nEnter Mapeh grade:\t\t"); scanf("%d",&mapeh); if (mapeh > 92) printf("\n\n\tAlam ka na ah\n************************************************************************\n"); if (mapeh < 92) printf("\n\n\tAmo na lang ni nubo pa?\n************************************************************************\n"); printf("\nEnter Val Ed grade:\t\t"); scanf("%d",&val); if (val > 92) printf("\n\n\tPa Heaven ka na guro bwas\n************************************************************************\n"); if (val < 92) printf("\n\n\tOyyyy bad\n************************************************************************\n"); printf("\nEnter Computer grade:\t\t"); scanf("%d",&comp); if (comp > 92) printf("\n\nMa'am Lacson Jr.\n************************************************************************\n"); if (comp < 92) printf("\n\n\tAlay sa kamot ma type beh mo\n************************************************************************\n"); printf("\nEnter Research grade:\t\t"); scanf("%d",&research); if (research > 92) printf("\t\n\nIkaw na gid ya\n************************************************************************\n"); if (research < 92) printf("\n\n\tWala na ni ya duda ya\n************************************************************************\n"); printf("\nEnter Advance Bio grade:\t"); scanf("%d",&adv_bio); if (adv_bio > 92) printf("\n\n\tScientist\n************************************************************************\n"); if (adv_bio < 92) printf("\n\n\tWala mn ko gni may ma inchindihan sa report\n************************************************************************\n"); printf("\n\n\n\n\n Computing.....1....2....3....4\n\n\n\n"); fgfil = fil * 1.2; fgeng = eng * 1.2; fgmath = math * 1.2; fgsci = sci * 1.2; fgap = ap * 0.9; fgtle = tle * 1.2; fgmapeh = mapeh * 1.2; fgval= val * 0.9; fgcomp = comp * 0.6; fgresearch = research * 0.9; fgadv_bio = adv_bio * 0.9; overall = fgfil + fgeng + fgmath + fgsci + fgap + fgtle + fgmapeh + fgval + fgcomp + fgresearch + fgadv_bio; finalgrade = overall/11.4; system("cls"); printf("\n\n\n\n\n\t\t\tYour final grade is %.3f",finalgrade); if (finalgrade > 92) printf("\n\t\t\tCongrats Honorol ba"); if (finalgrade < 92) printf("\n\t\t\tTuon pa tudo ahh"); } } getch(); } }
nv3
В чем твоя проблема? Просто опубликуйте ту часть кода, с которой у вас возникли проблемы. Я думаю, что никто не потратит время, чтобы прочитать и запустить всю вашу программу. Познакомьтесь с отладчиком, чтобы точно определить проблему.
[no name]
Нет, мы не являемся сервисом "отладьте мою кодовую базу домашних заданий для меня". Научитесь использовать отладчик, и он поможет найти и исправить ошибки в вашем коде.
Stefan_Lang
Чтобы помочь вам, нам обычно нужно хотя бы какое-то описание того, что происходит не так. Итак: а чего вы ожидали? Что же произошло вместо этого? Что вы пытались сделать, чтобы ограничить возможные причины такого неожиданного поведения?
Без этой информации любая попытка ответа - просто удар в темноту. И именно поэтому большинство ответов были столь негативными.
Несмотря на это, я попытался получить представление о том, что делает ваша программа, и заметил, что вы допустили ошибку во всех своих операторах scanf: см. Решение 3. Я не могу сказать, решает ли это вашу проблему, так как вы не сказали, в чем ваша проблема, но, пожалуйста, посмотрите и примите ответ, если он решит вашу проблему.