Hello People! This is my first forum topic and from the looks of it it will not be the last one. Anyway, my assignment is to build a questionaire game show. My idea was to make every correct answer 25 points and incorrect ones zero.
Under the main function I asked the user his/her name and asked whether she/he was ready to play or not. After the main function comes sorubir, soruiki and so on. Is it possible to sum up return values of functions and then display it at the end under the main function. Feel free to ask for any translations if its making your job any more difficult. (Dogru cevap = correct answer, yanlis = wrong.)
Thank you in advance!
It is possible, but you have to assign it to a variable, or total the function calls.
For example, you could do the following in your main function:
(beginning)
int Q1, Q2, Q3, Q4, total = 0;
...
...
...
(if you want to play)
Q1 = sorubir();
Q2 = soruiki();
Q3 = soruuc();
Q4 = sorudort();
(exit if statement)
total = Q1 + Q2 + Q3 + Q4;
printf("Total is: %d\n", total);
(end)
Another problem with your code is that all of your functions come after the main function. If you are going to do that you have to prototype, which means putting all the function definitions above the main. For example the prototype for the sorubir function would be:
int sorubir();
you would do the same with the other functions, putting it above the main function. OR you can just move all of your functions above the main() function.