im trying my own experiment with my C++ program. acording to what i just learned in my C++ book for dummys.. this should work yet dosen't. the code is in the lines it should be in for it with #include <iostream> as line 1
#include <iostream>
using namespace std;
int main()
{
int tom, dick, harry;
tom = 10;
dick = 20;
harry = 3254;
cout << tom, dick, harry << endl;
return 0;
}
after this is entered i build yet the error i come up with is
||=== variable, Debug ===|
C:\Documents and Settings\kitane\Desktop\variable\main.cpp||In function `int main()':|
C:\Documents and Settings\kitane\Desktop\variable\main.cpp|11|error: invalid operands of types `int' and `<unknown type>' to binary `operator<<'|
||=== Build finished: 1 errors, 0 warnings ===|
Variables to cout are passed just like endl in your example (they must be separated with insertion operator << ) so line 11 should be cout << tom<<dick<< harry << endl;
Btw, use [co de][/co de] tags (without spaces) to make source code more readable.