[[lesson_2_syntax.cpp]] Rescued by C++ Reloaded

Route:


[user02@FC4 Lesson02]$ cat -n syntax.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 cout << Use quotes around messages\n; 7 8 return 0; 9 } 10
[user02@FC4 Lesson02]$ g++ -o syntax syntax.cpp
syntax.cpp:6: error: stray ?e\?f in program
syntax.cpp: In function ?eint main()?f:
syntax.cpp:6: error: ?eUse?f was not declared in this scope
syntax.cpp:6: error: expected `;' before ?equotes?f



[user02@FC4 Lesson02]$ cat -n syntax2.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 cout << "Use quotes around messages\n"; 7 8 return 0; 9 }
[user02@FC4 Lesson02]$ g++ -o syntax2 syntax2.cpp
[user02@FC4 Lesson02]$ ./syntax2
Use quotes around messages
[user02@FC4 Lesson02]$



Using endl rather than \n.

1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 cout << Use quotes around messages << endl; 7 8 return 0; 9 }


1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 cout << "Use quotes around messages" << endl; 7 8 return 0; 9 }

lesson_2_syntax.cpp, Rev. 2, Last changed on 2005-08-06 16:01, 372 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.203 seconds || || PAGERANK TOOLS