Lecture #3
Lecture #3
PROBLEM SOLVING
(FALL 2022-23)
Lecture 3
REVISION
2
PROGRAM ANALYSIS EXAMPLE
ANALYZE YOUR FIRST C++
PROGRAM
u The classic first program that everyone writes:
Hello, World!
ch01/hello.cpp
1 #include <iostream>
2
3 using namespace std;
4
5 int main()
6 {
7 cout << "Hello, World!" << endl;
8 return 0;
9 }
u Cay Horstmann:
§ Chapter 1: Section 1.6,1.3
BE AWARE OF PROGRAMMING ERRORS
u Programing language follow very strict syntax
conventions and may generate a compile time
error (syntax error) or runtime error/Logic error.
For example:
\n New line
\t Horizontal tab
\\ Backslash
\’ Single quote
\” Double quote
\b Backspace
https://en.cppreference.com/w/cpp/language/escape
PROGRAMMING TILL EXECUTION
(shown as a flowchart)