Help me find errors

so following program counts and prints meanings of b
and
http://imageshack.us/photo/my-images/545/4ekz.jpg/

and I have to find errors and mistakes in the program
help please :(

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
using namespace std;
int main(){
a;
cin>>a
if(a=3) { b=a; cout<<"b="<<b<<"\n";}
if (a>3) b=a*5; cout<<"b="<<b<<"\n";
else {b=a]4; cout<<"b="<<b<<"\n";}
system("pause")
return 0;
}
Messy messy code... *sigh*
Ok first:
a; does not mean anything - you need to define a as a variable with a type.
cin>>a is missing a semicolon (;)
b=a; you never declared b.
if(a=3) should be if (a == 3) else {b=a]4; - just no...
system("pause") another semicolon missing.
Apart from that I can't see more mistakes by just looking at the code, tell me if you get it to work or not :)
Last edited on
Of course its messy - its a homework exercise, not actual code.
thank you so much!
Topic archived. No new replies allowed.