
C++ Programming (Basic)
Presentation
•
Computers
•
University
•
Hard
Chong May
Used 4+ times
FREE Resource
40 Slides • 1 Question
1
C++ Programming (Basic) -Revision
from input until function
2
Today's topics
Basic C++ function (input, output)
Selection control
Repetition control
Simple array
Simple function
3
Learning outcome 1:
How to use input\output in a program
How to use the selection control structures if, if...else, and switch in a program.
4
Key term for first part
Input output (cin, cout)
Selection (if … else, switch, case)
5
Programming Question 1
Write a program that takes a given length as input expressed in feet and inches. Convert and output the length in centimeters
Convert the length in feet and inches to all inches:
–Multiply the number of feet by 12
Use the conversion formula (1 inch = 2.54 centimeters) to find the equivalent length in centimeters
6

10 Minute Timer
You can open this webpage in a new tab.
7
8
9
10
11
12
13
14
Question 2
Write a c++ program for currency converter. It can convert Ringgit Malaysia to British pounds, Canadian dollars, and Japanese yen. It should also able to let the user decide which currency they wish to convert. Option menu using the switch statement and the input validation using if..else statement.
Details:
1: Input money using "cin" in a double variable
2: 1 British Pound = 5.87 Ringgit Malaysia
3: 1 Canadian Dollar= 3.37 Ringgit Malaysia
4: 1 Japanese Yen = 0.038 Ringgit Malaysia
5: Include the input validation in the system.
15

15 Minute Timer
You can open this webpage in a new tab.
16
Learning outcome 2:
How to use the repetition (looping) control structures
How to use the array in the C++ program
How to write and use a simple function
17
Key term for first part
While loop
For loop
Do while loop
Array
Function prototype
18
19
20
21
22
23
24
25
26
27
Question 3:
Write a c++ program that can print the Left oriented right angled pyramid as below.
Enter the number of rows: 5
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19
20 21 22
23 24
25
28

15 Minute Timer
You can open this webpage in a new tab.
29
Question 4
Using an array, read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read.
30

15 Minute Timer
You can open this webpage in a new tab.
31
32
33
34
35
36
Question 5:
Develop an interactive program that will keep track of the weather forecast in a month. On any given day, the weather forecast may be hot, rainy, or cloudy. Your program should input the weather forecast for each day in the month and should display the number of hot, rainy, and cloudy days in a month. You should use a loop and a conditional structure to develop this program. Try to implement functions in the solution.
37

20 Minute Timer
You can open this webpage in a new tab.
38
39
40
Open Ended
Any question?
41
C++ Programming (Basic) -Revision
from input until function
Show answer
Auto Play
Slide 1 / 41
SLIDE
Similar Resources on Wayground
36 questions
GDSC TU Introduction to Machine Learning and Its Applications
Presentation
•
University
35 questions
M0dule2 CPE4O8
Presentation
•
University
36 questions
Levels of Organization - Cells to Biome
Presentation
•
KG
38 questions
W7 - IP Addressing (SY24-25/C305-302I)
Presentation
•
University
34 questions
IntroDatabases
Presentation
•
University
33 questions
operator overloading
Presentation
•
KG - University
36 questions
BBB3103/BBB3033 EOP Unit 1
Presentation
•
University
Popular Resources on Wayground
20 questions
"What is the question asking??" Grades 3-5
Quiz
•
1st - 5th Grade
20 questions
“What is the question asking??” Grades 6-8
Quiz
•
6th - 8th Grade
10 questions
Fire Safety Quiz
Quiz
•
12th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
34 questions
STAAR Review 6th - 8th grade Reading Part 1
Quiz
•
6th - 8th Grade
20 questions
“What is the question asking??” English I-II
Quiz
•
9th - 12th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
47 questions
8th Grade Reading STAAR Ultimate Review!
Quiz
•
8th Grade
Discover more resources for Computers
15 questions
LGBTQ Trivia
Quiz
•
University
36 questions
8th Grade US History STAAR Review
Quiz
•
KG - University
25 questions
5th Grade Science STAAR Review
Quiz
•
KG - University
16 questions
Parallel, Perpendicular, and Intersecting Lines
Quiz
•
KG - Professional Dev...
20 questions
5_Review_TEACHER
Quiz
•
University
10 questions
Applications of Quadratic Functions
Quiz
•
10th Grade - University
10 questions
Add & Subtract Mixed Numbers with Like Denominators
Quiz
•
KG - University
20 questions
Block Buster Movies
Quiz
•
10th Grade - Professi...