I was making a code for my sister to help her with some homework this is what i came up with, but i keep getting build errors can someone fix it and post the fixed version?
its to big to copy and paste here, so i uploaded it on media fire in a txt file thx.
http://www.mediafire.com/?hukci3mukjt
thanks in advance =)
Help me with this C++ code.?
You have three errors: first, you're missing a semicolon on the line "char cchoose" second, you have a semicolon after the if-statement, if statements don't have semicolons which follow them. Finally, you are using \ instead of / for the division.
Let me help you understand your error messages, as it is essential that you understand what they mean so you won't have issues debugging your program.
Here are the error messages I received when I tried to compile your program:
new.cpp: In function `int main()':
new.cpp:10: error: expected initializer before "double"
new.cpp:20: error: `cchoose' was not declared in this scope
new.cpp:23: error: `ddiameter' was not declared in this scope
new.cpp:26: error: stray '\' in program
new.cpp:26: error: expected `)' before numeric constant
new.cpp:32: error: expected primary-expression before "else"
new.cpp:32: error: expected `;' before "else"
The main thing to do is to look solely at the top error message. Many times the subsequent error messages are caused by the top one, and thus really aren't errors.
We see the first error complains about not finding an initializer before "double" simply meaning it was expecting "=" instead of "double." You can deduce that this means the compiler wasn't expecting the keyword 'double.' This is usually indicative of a semicolon or parenthesis missing.
Most errors can be found by simply looking at the line number in which the error occurs, or the lines before it. Search around the line in which the error is occurring and normally the error can be quickly found and fixed. It is very important to note that just because the compiler error occurs on, say, line 20 that the actual syntax error isn't on, say, line 10. Read the error messages and attempt to understand their meaning.
Reply:The only error I can see is a semi-colon after an if (condition) parenthese. :/
Also, try using http://www.pastebin.ca or http://www.pastebin.com
for your scripts, it saves many people downloading, and will make more people check out your code.
Reply:If you are still stuck may be you can contact a C++ expert live at website like http://askexpert.info/ .
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment