0% found this document useful (0 votes)
10 views6 pages

Final Activity - Baloloy

dasdasdas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

Final Activity - Baloloy

dasdasdas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

National University

C++ Programming

Final Activity

Name: Baloloy, Jeremy B.

Date of Submission: June 22, 2024

A. PREPARATION:

I used https://www.onlinegdb.com/online_c++_compiler as my compiler as it serve the


best ability to run my codes.

B. COPY OF PROGRAM
C. PROCESS

COMPLETE CODE:

#include <iostream>

using namespace std;

int

main ()

string response1;

cout <<"Jm sari-sari store" << endl<< endl<< "Hello, how may I help you? Do you
wanna buy something?" << endl << "You: ";
cin >> response1;

int restart = 0;

while(restart == 0) {

if (response1 == "Yes" || response1 == "yes" || response1 == "YES")

string response2;

int response3;

cout <<

"What you want to buy? (c - Candy, h - Chocolate, l - Lollipop, m -


Marshmallow)"

<< endl << "You: ";

cin >> response2;

if(response2 == "C" || response2 == "c"){

response2 = "candy";

else if(response2 == "H" || response2 == "h"){

response2 = "chocolate";

else if(response2 == "L" || response2 == "l"){

response2 = "Lollipop";

else if(response2 == "M" || response2 == "m"){

response2 = "marshmallow";
}

cout << "How many?"<< endl << "Available stocks:"<< endl<< "1. Candy -
20 pcs" << endl <<

"2. Chocolate - 20 pcs" << endl << "3. Lollipop - 20 pcs" << endl <<
"4.Marshmallow - 20 pcs" <<endl << "You: ";

cin >> response3;

if(response3 > 20){

while (response3 > 20) {

string response4;

cout << "Sorry, we have insufficient amount of " << response2 << ". Do you still
want to proceed?" << endl

<< "You: ";

cin >> response4;

if (response4 == "yes") {

cout << "How many?" << endl << "You: ";

cin >> response3;

} else if (response4 == "no") {

cout << "Thank you for visiting!";

return 0;

cout << "Thank you sir/ma'am for buying " << response3 <<" pcs of
"<<response2<<" to us. Come again please!";
return 0;

restart = 1;

else if(response1 == "No" || response1 == "no" || response1 == "NO"){

cout << "Thank you for visiting, have a good day ahead!";

restart = 1;

else{

cout << "I can't understand you, do you wanna buy something?" << endl
<< "You: ";

cin >> response1;

restart = 0;

return 0;

D. REACTION TO THE ACTIVITY PROCESS

It was fun and exciting! It was fun to see that our knowledge weren’t all for naught and
exciting when our code finally succeed
E. CONCLUSION

In this final activity, we finally assimilated and combined all of our understanding and
knowledge from our past lessons. It was very satisfying seeing your code being a
compilation of different operations that we have discussed in our previous sessions.

You might also like