Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <iomanip>
- using namespace std;
- void functionOne();
- void functionTwo();
- void functionThree();
- void functionFour();
- void functionFive();
- void functionSix();
- void functionSeven();
- void functionEight();
- void functionNine();
- void functionTen();
- int main()
- {
- int randNum = 0;
- char ch = 'N';
- bool done = false;
- cout << "This will pick a function at random til you say 'y' or 'Y' for quitting!!!" << endl;
- randNum = rand() % 100;
- while (!done)
- {
- if (ch == 'y' || ch == 'Y')
- done = true;
- else
- {
- switch(randNum / 10)
- {
- case 0:
- functionOne();
- break;
- case 1:
- functionTwo();
- break;
- case 2:
- functionThree();
- break;
- case 3:
- functionFour();
- break;
- case 4:
- functionFive();
- break;
- case 5:
- functionSix();
- break;
- case 6:
- functionSeven();
- break;
- case 7:
- functionEight();
- break;
- case 8:
- functionNine();
- break;
- case 9:
- functionTen();
- break;
- default:
- cout << "Something went terribly wrong!" << endl;
- break;
- }
- }
- cout << "Number is: " << randNum << endl;
- cout << "Do you want to quit? (y/n): ";
- cin >> ch;
- cout << endl;
- randNum = rand() % 100;
- }
- return 0;
- }
- void functionOne()
- {
- cout << "function one called" << endl;
- }
- void functionTwo()
- {
- cout << "function two called" << endl;
- }
- void functionThree()
- {
- cout << "function three called" << endl;
- }
- void functionFour()
- {
- cout << "function four called" << endl;
- }
- void functionFive()
- {
- cout << "function five called" << endl;
- }
- void functionSix()
- {
- cout << "function six called" << endl;
- }
- void functionSeven()
- {
- cout << "function seven called" << endl;
- }
- void functionEight()
- {
- cout << "function eight called" << endl;
- }
- void functionNine()
- {
- cout << "function nine called" << endl;
- }
- void functionTen()
- {
- cout << "function ten called" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment