Hello,
I started making a program that would convert your test results into a percentage, making snide remarks on your grade. I ran it through codepad.org, and I got an error at line 18, which was a blank space. Here's the code itself:
It's been driving me absolutely bonkers. It's probably super-obvious too, I'm just not seeing it at the moment. If you could help me out, I would be much obliged!
Line 18: error: character constant too long for its type
cc1plus: warnings being treated as errors
In function 'int main()':
Line 39: warning: suggest parentheses around assignment used as truth value
Line 77: warning: suggest parentheses around assignment used as truth value
Line 82: warning: suggest parentheses around assignment used as truth value
Line 88: error: expected primary-expression before '}' token
compilation terminated due to -Wfatal-errors.
cc1plus: warnings being treated as errors
In function 'int main()':
Line 39: warning: suggest parentheses around assignment used as truth value
Line 74: warning: suggest parentheses around assignment used as truth value
Line 79: warning: suggest parentheses around assignment used as truth value
Line 86: error: expected primary-expression before '}' token
compilation terminated due to -Wfatal-errors.
So I tested a slightly tweaked version of Lethal's code, and it seemed to work only when I failed a test. I noticed that when I have it make a comment, at the end it says
return 0;
. That might be stopping it from activating the "start over?" loop. I got rid of it, and here is the code now:
But, of course, it couldn't be that simple. Now it complains like this:
prog.cpp: In function 'int main()':
prog.cpp:87: error: expected `while' before '}' token
prog.cpp:87: error: expected `(' before '}' token
prog.cpp:87: error: expected primary-expression before '}' token
prog.cpp:87: error: expected `)' before '}' token
prog.cpp:87: error: expected `;' before '}' token
prog.cpp: At global scope:
prog.cpp:87: error: expected unqualified-id before 'while'
prog.cpp:88: error: expected declaration before '}' token
Any ideas?
Note: when I said 'work' at the top, I meant: do the calculation, give you the percent, snide comment, then it asks for another test. If 'y' was entered, it would start over. if 'n' was entered, it would close.