ERROR OF CODING

Actually my lecturer gave me some exercise. She wanted me to find what's the error of this coding. Can you guys please help me to find the error and make it a correct coding? ASAP


#include <iostream>

using namespace std;

const char = STAR = '*'
cont int PRIME = 71;

int main
{
int count, sum;
double x;

count = 1;
sum = count + PRIME;
x := 25.67;
newNum = count * ONE + 2;
sum + count = sum;
x = x + sum * COUNT;
cout << "count = " <<count<< " , sum = " <<sum << ", PRIME =" <<endl;
}
Did you try to compile the code? That should help you to quickly identify problem areas (there are several).
She wanted me to find what's the error of this coding.
Then I guess she didn't want someone else to find the errors for you?
I did and I tried to change some codes there. But yeah I just new with these C++ so that's why I ask here :) can you solve it?
closed account (48T7M4Gy)
Have you examined it yourself or tried to run it?

we better not correct it because your lecturer might be watching and will get upset.

Please enclose code between tags <> in format bar on the right.
closed account (48T7M4Gy)
Show us your changes and error messages please.
I already ran it and yeah it's failed. I'm hoping that you can solve this because I really can't do it
closed account (48T7M4Gy)
So what were the error messages?

Code tags ??
Last edited on
5 12 I:\C++\rexha.cpp [Error] expected unqualified-id before '=' token
9 1 I:\C++\rexha.cpp [Warning] extended initializer lists only available with -std=c++11 or -std=gnu++11
10 2 I:\C++\rexha.cpp [Error] expected primary-expression before 'int'
10 2 I:\C++\rexha.cpp [Error] expected '}' before 'int'
10 2 I:\C++\rexha.cpp [Error] expected ',' or ';' before 'int'
13 2 I:\C++\rexha.cpp [Error] 'count' does not name a type
14 2 I:\C++\rexha.cpp [Error] 'sum' does not name a type
15 2 I:\C++\rexha.cpp [Error] 'x' does not name a type
16 2 I:\C++\rexha.cpp [Error] 'newNum' does not name a type
17 2 I:\C++\rexha.cpp [Error] 'sum' does not name a type
18 2 I:\C++\rexha.cpp [Error] 'x' does not name a type
19 2 I:\C++\rexha.cpp [Error] 'cout' does not name a type
20 1 I:\C++\rexha.cpp [Error] expected declaration before '}' token


You got it?
closed account (48T7M4Gy)
Yeah I got it but because you refuse to put code tags around the program listing you will have to locate where each line is.

But error number 1 says line 5 has an error before the = . Might be the first or second = on that line

Fix it up, recompile and go through the errors you get line by line.

You got it?
Last edited on
What kind of code tags is? Sorry I'm just new with this C++
closed account (48T7M4Gy)
OK, on the right hand side in the Format: box there is a button <>

Select the text in your post and press the button. That should put code tags around your program

line 1
line 2
...

becomes

1
2
3
line 1
line 2
...
closed account (E0p9LyTq)
najihanzd wrote:
What kind of code tags is? Sorry I'm just new with this C++

How to use code tags - http://www.cplusplus.com/articles/jEywvCM9/
Topic archived. No new replies allowed.