Hi guys, i started learning c++, just needed a little help with a problem of mine.
Im having some problem with the "cout" statements, (im doing this with code::block)
if i code this,
#include <iostream>
int main()
{
using namespace std;
cout << " Whats up doc ? " << end1;
return 0;
}
the compiler complains that "end1" was not declared, where i learned that end1 is included in "namespace std"
so i rewrite line the #5 like this,
cout << " Whats up doc ? \n";
and it compiles perfectly. but if i do this to cout an expretions end result like,
#include <iostream>
int main()
{
using namespace std;
cout << 2 + 5 \n;
return 0;
}
i get error msg "stray '\' in program" (Dont even know what that means)
so i compiled it without using anything at the end of line 5 (and 6),
#include <iostream>
int main()
{
using namespace std;
cout << 2 + 5;
cout << 2 + 8;
return 0;
}
compiles okay but, shows the result(in comand line) like
710
where i wanted to see
7
10
i tried alot to solve this myself but failed every time.
thanks, hope you wont be annoyed for this.