I am writing a simple program (more of a template for later programs, really) to quickly program quizzes to help me in school. There are no compiling errors, but when I open the cmd prompt exe, it says "Quiz.exe has stopped working." The code's too long to put in here, so I'll try to fit it in the replies.
The default compiler with CodeBlocks, GNU I think? And I realized that and put the return statement with no luck. I've learned about arrays, but I've been struggling to actually put them in code and I tried using functions but that hasn't changed anything either.
int totalquestions = 0;
int correctanswers = 0;
int incorrectanswers = 0;
int percent = correctanswers/totalquestions*100;
This is telling the program to do 0/0 * 100. Dividing by zero is not possible, and it fails. Try setting total questions to the actual number of questions (20).
About arrays, what exactly are you having problems with?
Oh, I just changed those into one variable, answer, that just changed with each question and user input. And the functions just didn't serve much of a purpose to me. I'm pretty new to programming, only been doing C++ for a few months, so I'm not too great at keeping it clean.
Nope, got it. Just had to make correctanswers and questions doubles as well. Thank you for all of the help! I'd still be stuck on my original problem. It works like a charm now! :)