Professional Documents
Culture Documents
PREPARED BY:
SUBMITTED TO:
Sr. KHAIRULAZHAR BIN ZAINUDDIN
24 MAY 2021
1. Introduction
Student in GLS 550 having difficulty on testing their comprehension to this subject.
According to their lecturer, most or few of them are having a lack of understanding
based on topic of Control Selection in this subject. Most students unable to measure
their achievement in the area. So to help with that, we have to develop a programming
which can provide them aid to measure their achievement in their subject so that
students would be motivated to know if they are over achieved or under achieved and
it also will help them in explore more in the topics and areas in subject.
Objective of Works
To develop a programming using selection control structure to determine
student achievement in GLS 550 course to date.
2. Method Of Solution
a. Analysis
Problem – Find the way for student to determine their achieved
comprehension in programming studies and in the way for student to
get feedback for motivation.
Solution –
a) Prompt the user at the first line “this is to self-test your programming
understanding.”
b) Ask the user either he/she understand how to program using c++
c) Ask the user either he/she understand how to use the selection control
structure. Otherwise, the program need to prompt user to spent more time to
study and practice coding using c++ for better grade.
d) Greeting the user if he/she understand to use selection control structure.
Otherwise, prompt the user to spent more time to learn selection structure.
e) The program should be able to repeat again.
Q1: if understand program enter Y then print out. "Do you understand how to
use the selection control structure?"
else, enter N print "You must spend more time to study and practice coding
using C++ for better result."
2
if Q1 understand. Ask user know the use selection control structure
else, enter N print "You must spent more time to learn selection structure."
if user want to try again enter Y then the program will continue.
b. Algorithm
Start
Greeting the user
Ask user for their name and matrics number
Print_greeting the user and display their name with matrics number.
ask user either understand program?
IF_Yes, print understand to use selection control structure?
ELSE IF_ No ,print you must spend more time to study and practice coding
using C++ for better result
IF_Yes, print thank you because understand selection control structure
ELSE IF_ No, print user need to spent more time and focus to learn selection
control structure
ask user either want to try again?
IF_ Yes, goto again
ELSE IF_ goto done
End
3
c. FlowChart
START
PROMPT
(Greeting)
INPUT
PRINT DISPLAY
“Greet User"
Else if: NO
INPUT
Else if:
“Yes/No”
NO
OUTPUT PRINT If: YES
PRINT
YES
“Do you want try again?”
NO
END
Figures 1.
4
D. Inputing The Coding
**************/
#include <iostream> ( call as the header or library file e.g cin & cout )
#include<stdlib.h> ( call as clear screen & must be compare with system (“cls”) )
{ ( Input )
start:
cout << "Assalamualaikum, Hope you having a great day today !";
cout << "\nPlease Enter Your Name : "; ( cout : for display the output on the computer screen)
cin >> name; ( cin :For input of the output to make the system
works)
cout << "\n*** This program is for self-test your programming understanding ! ***"<<endl;
cout << "Please enter 'Y' for **YES** and 'N' for **NO** for each question that will be ask!"<<endl;
cin >>question;
if (question=='y'||question=='Y')
else if (question=='n'||question=='N')
5
cout << "That's NOT GOOD! You must spend more time to study and practice coding using C++ for better
result";
else
cout << "\n 2. Do understand how to use the selection control structure? : ";
if(selection=='y'||selection=='Y')
cout << "That's GOOD! You understand to use selection control structure !!";
else if (selection=='n'||selection=='N')
cout << "That's NOT GOOD! You need to spent more time and focus to learn selection control structure !!";
else
cin>>again;
done:
6
3. Result
Coding in C++
(Figures 2)
This is the result when the user understand all the question that had been asked.
(Figures 3)
7
This is when the user didn’t understand the first question that been asked.
Figure 4
This is the result when the user didn’t understand 2nd of the question that been asked.
Figure 5
This is when the user accidentally type the wrong key for the answer of the question.
8
Figure 6
5. References
Introduction to Programming (GLS 550), Chapter 4
9
Exercise of week 6 with Sir KhairulAzhar
- Exercise 2 Selecting Manifying (Nested If)
- Exercise 3 Switch Function ( Switch Statement)
APPENDIX A
/***************
10
Title : Assignment 1
Question: Develop a program using selection control structure to determine student achievement in GLS550 course to date.
- Prompt the user at the first line “this is to self-test your programming understanding”.
- Ask the user either he/she understand how to program using c++
- Ask the user either he/she understand how to use the selection control structure. Otherwise, the program need to prompt
user to spent more time to study and practice coding using c++ for better grade.
- Greeting the user if he/she understand to use selection control structure. Otherwise, prompt the user to spent more time to
learn selection structure.
Analysis :
Q1: if understand program enter Y then print out. "Do you understand how to use the selection control structure?"
else, enter N print "You must spend more time to study and practice coding using C++ for better result."
else, enter N print "You must spent more time to learn selection structure."
if user want to try again enter Y then the program will continue.
2. Algorithm:
Start
11
Greeting the user
print greeting the user and display their name with matrics number.
else if no print you must spend more time to study and practice coding using C++ for better result
else if no print user need to spent more time and focus to learn selection control structure
End
3. Coding
5. Documentation
CODING
**************/
12
#include <iostream>
#include<stdlib.h>
int main()
start:
system("cls");
char start,name[30],question,selection,again;
int number;
cout << "Assalamualaikum, Hope you having a great day today !";
cout << "\n*** This program is for self-test your programming understanding ! ***"<<endl;
cout << "Please enter 'Y' for **YES** and 'N' for **NO** for each question that will be ask!"<<endl;
cin >>question;
if (question=='y'||question=='Y')
else if (question=='n'||question=='N')
13
cout << "That's NOT GOOD! You must spend more time to study and practice coding using C++ for better
result";
else
cout << "\n 2. Do understand how to use the selection control structure? : ";
if(selection=='y'||selection=='Y')
cout << "That's GOOD! You understand to use selection control structure !!";
else if (selection=='n'||selection=='N')
cout << "That's NOT GOOD! You need to spent more time and focus to learn selection control structure !!";
else
cin>>again;
if(again=='y'||again=='Y')goto start;
done:
14