Rachael Oke / Mbed 2 deprecated lab6

Dependencies:   mbed

Committer:
rachaeloke
Date:
Sun Mar 21 19:58:15 2021 +0000
Revision:
0:3381c1b60c1b
Display Hello World

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rachaeloke 0:3381c1b60c1b 1 #include <iostream>
rachaeloke 0:3381c1b60c1b 2
rachaeloke 0:3381c1b60c1b 3 using namespace std;
rachaeloke 0:3381c1b60c1b 4 int DisplayMenuGetChoice();
rachaeloke 0:3381c1b60c1b 5 void GoblinSickDays();
rachaeloke 0:3381c1b60c1b 6 void DisplaySomethingCool();
rachaeloke 0:3381c1b60c1b 7
rachaeloke 0:3381c1b60c1b 8
rachaeloke 0:3381c1b60c1b 9 int main ()
rachaeloke 0:3381c1b60c1b 10 {
rachaeloke 0:3381c1b60c1b 11 int option;
rachaeloke 0:3381c1b60c1b 12 do{
rachaeloke 0:3381c1b60c1b 13
rachaeloke 0:3381c1b60c1b 14 option = DisplayMenuGetChoice();
rachaeloke 0:3381c1b60c1b 15 switch(option)
rachaeloke 0:3381c1b60c1b 16 {
rachaeloke 0:3381c1b60c1b 17 case 1:
rachaeloke 0:3381c1b60c1b 18 GoblinSickDays();
rachaeloke 0:3381c1b60c1b 19 break;
rachaeloke 0:3381c1b60c1b 20 case 2:
rachaeloke 0:3381c1b60c1b 21 DisplaySomethingCool();
rachaeloke 0:3381c1b60c1b 22 break;
rachaeloke 0:3381c1b60c1b 23 case 3:
rachaeloke 0:3381c1b60c1b 24 return 0;
rachaeloke 0:3381c1b60c1b 25 break;
rachaeloke 0:3381c1b60c1b 26 default:
rachaeloke 0:3381c1b60c1b 27 cout << "invalid option, choose from option 1 - 3" << endl;
rachaeloke 0:3381c1b60c1b 28 }
rachaeloke 0:3381c1b60c1b 29
rachaeloke 0:3381c1b60c1b 30
rachaeloke 0:3381c1b60c1b 31 }while(option !=3);
rachaeloke 0:3381c1b60c1b 32
rachaeloke 0:3381c1b60c1b 33
rachaeloke 0:3381c1b60c1b 34
rachaeloke 0:3381c1b60c1b 35
rachaeloke 0:3381c1b60c1b 36 }
rachaeloke 0:3381c1b60c1b 37
rachaeloke 0:3381c1b60c1b 38 int DisplayMenuGetChoice()
rachaeloke 0:3381c1b60c1b 39 {
rachaeloke 0:3381c1b60c1b 40 cout << "1- enter Goblin Sick Days" << endl;
rachaeloke 0:3381c1b60c1b 41 cout << "2- enter Display Something Cool" << endl;
rachaeloke 0:3381c1b60c1b 42 cout << "3- enter End The Program" << endl;
rachaeloke 0:3381c1b60c1b 43 int option;
rachaeloke 0:3381c1b60c1b 44 cin >> option;
rachaeloke 0:3381c1b60c1b 45 return option;
rachaeloke 0:3381c1b60c1b 46 }
rachaeloke 0:3381c1b60c1b 47
rachaeloke 0:3381c1b60c1b 48 void DisplaySomethingCool()
rachaeloke 0:3381c1b60c1b 49 {
rachaeloke 0:3381c1b60c1b 50 cout << "_______ _______ _______ _______ _______ _ " << endl;
rachaeloke 0:3381c1b60c1b 51 cout << "( ____ )( ___ )( ____ \|\ /|( ___ )( ____ \( \ " << endl;
rachaeloke 0:3381c1b60c1b 52 cout << "| ( )|| ( ) || ( \/| ) ( || ( ) || ( \/| ( " << endl;
rachaeloke 0:3381c1b60c1b 53 cout << "| (____)|| (___) || | | (___) || (___) || (__ | | " << endl;
rachaeloke 0:3381c1b60c1b 54 cout << "| __)| ___ || | | ___ || ___ || __) | | " << endl;
rachaeloke 0:3381c1b60c1b 55 cout << "| (\ ( | ( ) || | | ( ) || ( ) || ( | | " << endl;
rachaeloke 0:3381c1b60c1b 56 cout << "| ) \ \__| ) ( || (____/\| ) ( || ) ( || (____/\| (____/\ " << endl;
rachaeloke 0:3381c1b60c1b 57 cout << "|/ \__/|/ \|(_______/|/ \||/ \|(_______/(_______/ " << endl;
rachaeloke 0:3381c1b60c1b 58
rachaeloke 0:3381c1b60c1b 59 }
rachaeloke 0:3381c1b60c1b 60
rachaeloke 0:3381c1b60c1b 61 void GoblinSickDays()
rachaeloke 0:3381c1b60c1b 62 {
rachaeloke 0:3381c1b60c1b 63 int num_tellers = 0;
rachaeloke 0:3381c1b60c1b 64 int teller;
rachaeloke 0:3381c1b60c1b 65 cout << "How many Goblins worked at Gringotts during each of the last 3 years?" << endl;
rachaeloke 0:3381c1b60c1b 66 cin >> teller;
rachaeloke 0:3381c1b60c1b 67
rachaeloke 0:3381c1b60c1b 68 for(int i = 0; i < num_tellers; i++)
rachaeloke 0:3381c1b60c1b 69 {
rachaeloke 0:3381c1b60c1b 70 for(int x = 0; x < 3; x++)
rachaeloke 0:3381c1b60c1b 71 {
rachaeloke 0:3381c1b60c1b 72 int num;
rachaeloke 0:3381c1b60c1b 73 cout << "how many days was Goblin out for during year 1?" << i << " and year " << x << endl;
rachaeloke 0:3381c1b60c1b 74 cin >> num;
rachaeloke 0:3381c1b60c1b 75 num_tellers += num;
rachaeloke 0:3381c1b60c1b 76 }
rachaeloke 0:3381c1b60c1b 77 }
rachaeloke 0:3381c1b60c1b 78
rachaeloke 0:3381c1b60c1b 79 }
rachaeloke 0:3381c1b60c1b 80
rachaeloke 0:3381c1b60c1b 81