why is this not valid?

solved
Last edited on
You are using cout << tbm(). That is basically calling the function and outputting it's return which is nothing. To use the functions to output simply call the function like this:

tmb();

If you want to drop to a newline after each function call you could type it like this:

1
2
3
4
5
6
7
tbm();
cout << endl;
tbm();
cout << endl;
shtr();
cout << endl;
shtr();


Any time you call a function the compiler basically takes the code within the function and places it where the function call is. Now, that isn't what actually happens, but conceptually it works (for basic functions like this anyway.) So what your compiler is actually seeing is this:

1
2
3
4
5
cout << cout<< "three blind mice" <<endl;
<< endl << cout<< "three blind mice" <<endl;
 << endl << cout<< "see how they run"<< endl;
 <<endl << cout<< "see how they run"<< endl;
 << endl; 


Do you see now why it is invalid?
Last edited on
You didn't have to delete your post. If you leave it other who had the same issue might have found it interesting. :)
Thanks for the reply sorry first time learning c++ myself and yes I understood right after I posted. Thanks again for the reply you will see a lot of me now lol I am going to be working on this for a while.
Don't delete posts. It's annoying to people who answered them. We don't answer questions specifically for the asker, we answer them so anybody with the same or similar question has a resource to go to.
hmm okay sorry about it.
Topic archived. No new replies allowed.