is sth wrong with cout I do nt see???

Please, does someone see the error? It is marked here:
if (a>3){cout<<f4()<<endl;};

and it goes for <<??? (couldnn't remember because pc crashed!)
Many thanks!!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  int f2(int d){
int e;
e=d+2;
return e;
}
 
int f3(int f){
int g;
g=f+3;
return g;
}
 
void f4(){
cout<<"Roar roar"<<endl;
}
int main(){
int a;
cin>>a;
 
cout<<endl<<endl<<endl;
//cout<<"a= "<<a<<endl<<endl;
/*if (a=1){cout<<f2(a)<<endl;};
  if (a=2){cout<<f2(a)<<endl;};
  if (a=3){cout<<f3(a)<<endl;};*/
 
/*cout<<f1(a)<<endl;
  cout<<f2(a)<<endl;
  cout<<f3(a)<<endl<<endl<<endl;*/
 
 
if (a==1){cout<<f1(a)<<endl;};
if (a==2){cout<<f2(a)<<endl;};
if (a==3){cout<<f3(a)<<endl;};
if (a>3){cout<<f4()<<endl;};
system("PAUSE");
return 0;
}
Last edited on
Well, f4() is a function that does not return anything (hence void). Since it does the cout itself just call it and don't use it with the stream:

if (a>3){cout<<f4()<<endl;};
BIG THANKS!!!
Topic archived. No new replies allowed.