I tried avoiding posting here again, since this is my fourth topic today.
Spent 15 minutess gazing at the code, fixing typos.
Now I cannot find any and it still wont work.
Code=
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
usingnamespace std ;
int main()
{
constdouble PI = 3.1415926536
cout << "6\" circle circumference: " << (PI * 6) << endl;
enum
{ RED=1, YELLOW, GREEN, BROWN, BLUE, PINK, BLACK } ;
cout << "I shot a red worth: " << RED << endl ;
cout << "Then a blue worth: " << BLUE << endl ;
cout << Total scored: " << ( RED + BLUE ) << endl ;
typedef enum { NEGATIVE , POSITIVE } charge ;
charge neutral = NEGATIVE , live = POSITIVE ;
cout << "Neutral wire: " << neutral << endl ;
cout << "Live wire: " << live << endl ;
return 0 ;
}
And cmd said..
1 2 3 4 5 6 7 8 9 10 11
C:\My Programs>c++ constant.cpp -o constant.exe
constant.cpp: In function `int main()':
constant.cpp:7: error: expected `,' or `;' before "cout"
constant.cpp:12: error: `Total' was not declared in this scope
constant.cpp:12: error: expected `;' before "scored"
constant.cpp:12: error: missing terminating " character
constant.cpp:13: error: `charge' was not declared in this scope
constant.cpp:14: error: expected `;' before "neutral"
constant.cpp:15: error: `neutral' was not declared in this scope
constant.cpp:16: error: `live' was not declared in this scope
constant.cpp:18:2: warning: no newline at end of file
Im at the end of the first chapter though, and probably will stop trying today after this is fixed. Then ill go over everything ive done. =3.
Thank you.
Anyways.. Ill post all of the problems later I get, after this one is fixed xD.
The code now is [added quote]:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
usingnamespace std ;
int main()
{
constdouble PI = 3.1415926536
cout << "6\" circle circumference: " << (PI * 6) << endl ;
enum
{ RED=1, YELLOW, GREEN, BROWN, BLUE, PINK, BLACK } ;
cout << "I shot a red worth: " << RED << endl ;
cout << "Then a blue worth: " << BLUE << endl ;
cout << "Total scored: " << ( RED + BLUE ) << endl ;
typedefenum { NEGATIVE , POSITIVE } charge ;
charge neutral = NEGATIVE , live = POSITIVE ;
cout << "Neutral wire: " << neutral << endl ;
cout << "Live wire: " << live << endl ;
return 0 ;
}
And cmd says:
1 2 3 4
C:\My Programs>c++ constant.cpp -o constant.exe
constant.cpp: In function `int main()':
constant.cpp:8: error: expected `,' or `;' before "co
constant.cpp:19:2: warning: no newline at end of file
constant.cpp:7 - missing ';' after line 6
constant.cpp:12 - missing " for the cout
constant.cpp:13: error: `charge' was not declared in this scope
constant.cpp:14: error: expected `;' before "neutral"
constant.cpp:15: error: `neutral' was not declared in this scope
constant.cpp:16: error: `live' was not declared in this scope
^^ im pretty sure ur syntax is way messed up for line 14.
C:\My Programs>c++ precendence.cpp -o precendence.exe
precendence.cpp: In function `int main()':
precendence.cpp:6: error: `num' was not declared in this scope
precendence.cpp:15:2: warning: no newline at end of file
I cannot find what is wrong with the "num" on line 6.
It's not that I'm getting tired of this or anything, but I think you're becoming dependent on us. Try to read the error messages more carefully. They are very descriptive, most of the time.
You've tried to create a function (fToC) inside main(). I was going to say move it above main() and it should be fine but reading further on you've got a bit confused somewhere. I think you need to look over that code again and try and understand what you have written before I give some help. I don't mean to sound rude but you'll learn more - you must have just been unfocused at the time.
Line 5 and 11 in particular... but there are a few other errors. I recommend re-writing this program honestly as it is only small and you can have a fresh start.