C++ Pseudocode
C++ Pseudocode
C++ Pseudocode
1 ACKNOWLEDGEMENT 1
2 PROJECT SUMMARY 2
3 PSEUDOCODE 3 – 13
4 FLOWCHART 14 - 29
5 LIST OF CODES 30 - 45
7 SCREEN LAYOUT 47 - 53
8 REFERENCES 54
1. ACKNOWLEDGEMENT
We would like to express our special thanks to Sir Zaaba for giving us the opportunity
to work together as a team which has help us tremendously in giving us a depth
understanding of the topic we have learnt in class. We would also like to acknowledge
the hard work and dedication our team member has given to make this project happen.
Lastly, we would like to give thanks to Allah for making this happen.
1
2. PROJECT SUMMARY
SUMMARY
Firstly, the system required the user’s name, ID students, part and faculty. As
the system processes the input, it will then display the state that we suggest to carry
out the extreme activities. The user can choose which state that they want to go. Then,
the program will display the list of extreme activities that available in that state. The
user can choose which activities that they interested, suitable budget and time.
PROBLEM
2
3. PSEUDOCODE
Start
Input
Input state
Data type : int
Variable Name : state
Input langkawi
Data type : int
Variable Name : langkawi
Input selangor
Data type : int
Variable Name : selangor
Input perak
Data type : int
Variable Name : perak
Input terengganu
Data type : int
Variable Name : terengganu
Input food
Data type : int
Variable Name : food
Input answer
Data type : int
Variable Name : answer
Input again
Data type : int
Variable Name : again
Input respond
Data type : char
Variable Name : respon
Input name
Data type : char
3
Variable Name : name
Input student’s ID
Data type : char
Variable Name : studentid
Input price
Data type : float
Variable Name : price
PROCESS
SET state, langkawi, selangor, perak, terengganu, food, answer, again to int
SET respond, name, studentid to char
SET price, pricefood, totalprice, eachprice to float
CALL greeting ()
Display "THIS ACTIVITIES MUST HAVE 5 PERSON IN EACH GROUP"
Display "Do you have 5 person in a group?"
Input respond
4
if state equal to 1 then
CALL chooseLangkawi()
CALL langkawi1(langkawi)
Calculate
totalprice + = price
Calculate
eachprice = totalprice/5
Endwhile
Endwhile
Output
5
“````````````````````````````````````````` “
“ You have successfully bought your ticket :)”
“THANK YOU & HAVE A NICE DAY”
“^^^^^^^^^^^^^^^^^^^^^^^^”
“_____________________________”
End
6
PSEUDOCODE (FUNCTION)
Module greeting()
START
Display“ _________________________________”
Display newline
Display “| |”
Display newline
Display “| Welcome to Our Worl |”
Display newline
Display “|______________________ ________|”
Display newline
RETURN
Module data()
START
Display “*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*”
Display “Enter information of students:”
SET i=0
FOR i < 5
Display “GROUP MEMBERS : “
Display “ENTER NAME”
Display “ENTER STUDENT’S ID”
Display “CONTACT INFORMATION:”
Display “PLEASE ENTER NAME : “
Display “PHONE NUMBER”
Display “*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*”
RETURN
Module state()
START
Display “* * * * * * * * * * * * * * * * * * * * * * * * * * *“
Display newline
Display ”* * * * * * (1) LANGKAWI * * * * * *”
Display newline
Display ”* * * * * * (2) SELANGOR * * * * * *”
Display newline
Display ”* * * * * * (3) PERAK * * * * * *”
Display newline
Display ”* * * * * * (4) TERENGGANU * * * * * *”
Display newline
Display ”* * * * * * * * * * * * * * * * * * * * * * * * * * *”
RETURN
7
Module chooseLangkawi()
START
Display “_____________________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~”
Display newline
Display “ (1) JET SKI AT DAYANG BUNTING (8 ISLANDS)”
Display newline
Display “ (2) TANDEM SKYDIVING”
Display newline
Display “_____________________________________________________”
Display newline
Display “WHICH ONE YOU CHOOSE? : "
Read langkawi
RETURN
Module chooseSelangor()
START
Display “_____________________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~”
Display newline
Display “ (1) BROGA HILLS”
Display newline
Display “ (2) SKYTEX ADVENTURE”
Display newline
Display “_____________________________________________________”
Display newline
Display “WHICH ONE YOU CHOOSE? : "
Read selangor
RETURN
Module choosePerak()
START
Display “_____________________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~”
Display newline
Display “ (1) GUA TEMPURUNG ”
Display newline
Display “ (2) X-PARK IPOH”
Display newline
Display “_____________________________________________________”
Display newline
8
Display “WHICH ONE YOU CHOOSE? : "
Read perak
RETURN
Module chooseTerengganu()
START
Display “_____________________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~”
Display newline
Display “ (1) DIVING PULAU PERHENTIAN”
Display newline
Display “ (2) HIKING BUKIT KELUANG”
Display newline
Display “_____________________________________________________”
Display newline
Display “WHICH ONE YOU CHOOSE? : "
Read terengganu
RETURN
9
Module langkawi1(langkawi)
START
if langkawi equal to 1 then
price=1000
Display “JET SKI AT DAYANG BUNTING (8 ISLANDS)”
Display newline
Display “DATE : 22/12/2018”
Display newline
Display “PRICE : RM”
Display “Would you like to add a food package that we provide?”
Display “IF YES, ENTER [1] . IF NO, ENTER [2] :”
Read food
10
Module selangor1(selangor)
START
11
Module perak1(perak)
START
if perak equal 1 then
price = 250
Display “GUA TEMPURUNG”
Display newline
Display “DATE : 1/12/2018”
Display newline
Display “PRICE : RM ”
Display “Would you like to add a food package that we provide?”
Display “IF YES, ENTER [1] . IF NO, ENTER [2] :”
Read food
else
Display “INVALID NUMBER”
End if
RETURN
12
Module terengganu1(terengganu)
START
if terengganu equal 1 then
price = 950
Display “DIVING PULAU PERHENTIAN”
Display newline
Display “DATE : 15/12/2018”
Display newline
Display “PRICE : RM ”
Display “Would you like to add a food package that we provide?”
Display “IF YES, ENTER [1] . IF NO, ENTER [2] :”
Read food
else
Display “INVALID NUMBER”
End if
RETURN
13
4. FLOWCHART
Start
greeting()
data()
STATE()
T
State
chooseLangkawi()
==1
langkawi1()
F
T State
chooseSelangor()
==2
selangor1()
F
T State
choosePerak()
==3
perak1()
F
T
State
chooseTerengganu()
==4
terengganu1()
C B
14
C B
again==0
F
T
totalprice +=price
eachprice = totalprice/5
print()
end
15
Module greeting()
Display “ _________________________________”
Display newline
Display “| |”
Display newline
Display newline
Display “|________________________________|”
Return
16
Module STATE ()
Display “* * * * * * * * * * * * * * * * * * * * * * * * * * *“
Display newline
Display newline
Display newline
Display newline
Display newline
Display ”* * * * * * * * * * * * * * * * * * * * * * * * * * *”
Display newline
Read state
Return
17
Module chooseLangkawi ()
Display“______________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~”
Display newline
Display newline
Display newline
Display “______________________________________________”
Display newline
Read langkawi
Return
18
Module chooseSelangor ()
s
Display“______________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~”
Display newline
Display newline
Display newline
Display “______________________________________________”
Display newline
Read selangor
Return
19
Module choosePerak ()
Display“______________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~”
Display newline
Display newline
Display newline
Display “______________________________________________”
Display newline
Read perak
Return
20
Module chooseTerengganu ()
Display“______________________________________________”
Display newline
Display “~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~”
Display newline
Display newline
Display newline
Display “______________________________________________”
Display newline
Read terengganu
Return
21
Module langkawi1 (int langkawi)
Read langkawi
Display
“DATE : 22/12/2018”
Display newline
T
Display”Would you like to add a food
Food==1 package that we provide”
display” RM ",pricefood
return
A
22
A
Display
“*****TANDEM SKYDIVIN
T *****”
langkawi
price= 1200 Display newline
==2
Display
“DATE : 23/12/2018”
Display newline
T
Display”Would you like to add a food
Food==1
package that we provide”
display” RM ",pricefood
return
Display
“INVALID
INPUT”
23
Module return
selangor1 (int selangor)
s
Read selangor
Display
“*****BROGA HILLS*****”
Display newline
selangor
price= 250 Display
==1
“DATE : 8/12/2018”
Display newline
T
Display”Would you like to add a
Food==1
food package that we provide”
display newline
display” RM ",pricefood
return
24
A
A
Display
“*****SKYTEX
ADVENTURE*****”
T
selangor
price= 50 Display newline
==2
Display
“DATE : 9/12/2018”
Display newline
T
F Food==1 Display”Would you like to add a
food package that we provide”
display” RM ",pricefood
return
Display
“INVALID 25
INPUT”
Module perak1 (int perak)
Display newline
Display
“DATE : 1/12/2018”
Display newline
T
Display “PRICE : RM”, price
perak
==1
Display”Would you like to add a
food package that we provide”
F
Food==1 return
pricefood=80
display” RM ",pricefood
A
26
A
F Display
“*****X-PARK IPOH*****”
“DATE : 8/12/2018”
Display newline
Food==1 return
pricefood=80
F
Display
“INVALID
INPUT” Display “Dessert & Lunch package”
display newline
display” RM ",pricefood
27
Module terengganu1 (int terangganu)
Read terangganu
Display
Display newline
Display
“DATE : 15/12/2018”
Display newline
F
Food==1 return
pricefood=150
A display newline
display” RM ",pricefood 28
A
Display
terangganu
==2 price= 250 “*****HIKING BUKIT
KELUANG*****”
Display newline
Display
“DATE : 16/12/2018”
Display newline
Food==1
return
T
F
pricefood=100
Display
“INVALID
INPUT”
display newline
display” RM ",pricefood 29
5. LIST OF CODES
#include <iostream>
#include <iomanip>
#include <math.h>
/* ctime example */
char respond, name [30], falculty [6], studentid[20], phone[15]; // global declare
struct student
char name[50];
30
int people, studentid; } s[5];
//funtion definiton
cout<<endl;
cout<<" | | "<<endl;
cout<<endl;
//funtion definiton
cout<<endl;
cin>>state;
//funtion definiton
31
void chooseLangkawi ()
cout<<"\n_________________________________________________________"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~ ~~~~"<<endl;
cout<<"
___________________________________________________________"<<endl;
cin>>langkawi;
//funtion definiton
cout<<"\n________________________________________________________"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"_________________________________________________________"<<endl;
cin>>selangor;
//funtion definiton
cout<<"\n_________________________________________________________"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~"<<endl;
32
cout<<" (1) GUA TEMPURUNG "<<endl;
cout<<"_____________________________________________________"<<endl;
cin>>perak;
//funtion definiton
cout<<"\n_____________________________________________________"<<endl;
cout<<~~~~~~~~~~~~~~~~~~ADVENTURE~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"_______________________________________________________"<<endl;
cin>>terengganu;
//funtion definiton
int langkawi1 (int langkawi) //function with parameter but no return value
if (langkawi==1)
{ price = 1000 ;
cout<<” ”endl;
cout<<" Would you like to add a food package that we provide? "<<endl;
33
cout<<" IF YES, ENTER [1] . IF NO, ENTER [2] : ";
cin>>food;
cout<<endl;
if (food==1)
cout<<endl;
pricefood=400;
cout<<” ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else if (langkawi==2)
{ price = 1200 ;
cout<<endl;
cin>>food;
cout<<endl;
if(food==1)
cout<<endl;
34
pricefood=100;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else
//funtion definiton
int selangor1 (int selangor) //function with parameter but no return value
if (selangor==1)
{ price = 250 ;
cout<<endl;
cin>>food;
cout<<endl;
if (food==1)
35
pricefood=50;
cout<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else if (selangor==2)
{ price = 400;
cout<<endl;
cin>>food;
cout<<endl;
if(food==1)
cout<<endl;
pricefood=80;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
36
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl;}
else
//funtion definiton
int perak1 (int perak) //function with parameter but no return value
if (perak==1)
{ price = 250 ;
cout<<endl;
cin>>food;
cout<<endl;
if(food==1)
cout<<endl;
pricefood=80;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
37
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else if (perak==2)
{ price = 450 ;
cout<<endl;
cin>>food;
cout<<endl;
if (food==1)
cout<<endl;
pricefood=80;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else
cout<<"INVALID VALUE"<<endl;
38
//funtion definiton
int terengganu1 (int terengganu) //function with parameter but no return value
if (terengganu==1)
{ price = 950;
cout<<endl;
cin>>food;
cout<<endl;
if (food==1)
cout<<endl;
pricefood=150;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else if (terengganu==2)
{ price = 250;
39
cout<<" *****HIKING BUKIT KELUANG*****"<<endl;
cout<<endl;
cin>>food;
cout<<endl;
if (food==1)
cout<<endl;
pricefood=100;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<" RM "<<pricefood<<endl;
cout<<" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !"<<endl;
cout<<endl; }
else
//funtion definiton
cout<<"-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"<<endl;
40
cout<<endl;
// storing information
s[i].people = i+1;
//cin>> s[i].people;
cout << "Group member :" << s[i].people << "," << endl;
cout<<"-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"<<endl;
cin>>name;
cin>>phone;
//funtion definiton
41
{
cout<<"_____________________________________________________________"<<endl;
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"<<endl;
cout<<" "<<endl;
time_t rawtime;
time (&rawtime);
cout<<" "<<endl;
cout<<endl;
cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "<<endl;
cout<<" "<<endl;
42
cout<<"\t\t***FOR REFERENCE YOU CAN CONTACT 017-9485876***\t "<<endl;
cout<<"_________________________________________________________"<<endl;
int main ()
cout<<endl;
cout<<endl;
cout<<endl;
cin>>answer;
cout<<endl;
cout<<endl;
cout<<endl;
43
{
if (state==1)
cout<<endl;
if (state==2)
cout<<endl;
if (state==3)
cout<<endl;
44
}
if (state==4)
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
totalprice += price+pricefood;
eachprice= totalprice/5;
break;
return 0;
45
6. DETAILS OF INPUT AND OUTPUT
Input Output
46
7. SCREEN LAYOUT
47
48
49
50
51
52
53
8. REFERENCES
http://www.cplusplus.com/doc/tutorial/
54