Introduction To C++ Programming
Introduction To C++ Programming
OBJECTIVES
After studying this unit, students would be able
to appreciate the following:
• Fundamental Concepts of C++ Programming
• Install CodeBlocks application software
• Identify basic features of CodeBlocks
• Demonstrate basic coding skills in CodeBlocks
1
INTRODUCTION
3
INTRODUCTION
4
Why learn C++?
• C++ is irreplaceable
• You learn the internal architecture of a
computer
• Over 600,000 C++ repositories on GitHub
• 60% Stack Overflow Answer rate and
active community
• C++ job opportunities and salary
6
C++ is Irreplaceable
7
Major Applications of C++
12
Things to Know Before you Code in C++
13
Compile and run C++ programming on OS
14
Compile and run C++ programming on OS
15
Code::Blocks Installation & Configuration
16
Code::Blocks Installation & Configuration
• Write the C++ code and save the file with .cpp
extension.
• To save the file, go to File > Save (Shortcut:
Ctrl + S).
• Important Note: The filename should end with
.cpp extension, like: hello.cpp, your-program-
name.cpp
17
Code::Blocks Installation & Configuration
18
Code::Blocks Installation & Configuration
19
C++ program
20
C++ program
#include <iostream>
using namespace std;
int main()
{
cout << "Hello Class BCE/BTE, Welcome to
our first C++ Programming Lesson" << endl;
return 0;
}
21
C++ program
22
How The Program Works
23
What is #include <iostream>?
25
What is using namespace std;?
26
What is using namespace std;?
27
What’s a namespace?
28
Why do you use namespace?
29
What is std?
Semicolon “;”
• The semicolon is a terminal. It terminates
a statement.
• When missed or incorrectly used, it will
cause a lot of issues.
30
int main() { }
32
What is a stream?
33
What is <<?
• What is <<
34
What is return 0;?
35
Why zero in return statement?
36
Guidelines in C++ Programming
37
Learning by doing
39
Read other’s C++ code
40
Break things
41
Join C++ communities
42
Join C++ communities
43
Conclusion
44
Coding Exercise One (1)
#include <iostream>
using namespace std;
int main()
{
int number;
46
Coding Exercise One (1)
Output Screen
47
QUESTIONS TIME
48
NEXT TOPIC
49
Reading Assignment
• Write a C++ Program to Add Two Numbers
50
References:
1. https://www.programiz.com/article/algorithm-programming
2. The C++ Programming Language (4th Edition)
3. Programming -- Principles and Practice Using C++ (2nd Edition)
51