lesson 2 syntax cpp
[[lesson_2_syntax_cpp]] last edit on
Aug 6, 2005
4:01 PM
by rescued_by_c
[user02@FC4 Lesson02]$ cat -n 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
[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\n;
7
8 return 0;
9 }
10
[user02@FC4 Lesson02]$ g++ -o syntax syntax.cppsyntax.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 }