Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <Windows.h>
- using namespace std;
- void animateFlomb(string , int );
- string flipHorizontal(string );
- string flipVertical(string );
- void dance(string , int );
- void rave(string , int );
- string defaultFlomb = "\\(O__O\\)", flomb;
- int main()
- {
- string option = "";
- while(option != "exit")
- {
- cout << "Please choose a function to test..." << endl
- << "\t[1] animateFlomb (flipVertical)" << endl
- << "\t[2] dance (flipVertical and flipHorizontal)" << endl
- << "\t[3] rave ;)" << endl << endl << "> ";
- cin >> option;
- if(option == "1") // animateFlomb
- {
- animateFlomb(defaultFlomb, 5);
- }
- else if(option == "2") // dance
- {
- dance(defaultFlomb, 5);
- }
- else if(option == "3")
- {
- rave(defaultFlomb, 15);
- }
- else if(option != "exit")
- {
- cout << endl << "Please try again." << endl << endl;
- }
- }
- return 0;
- }
- void animateFlomb(string input, int count)
- {
- system("color 0c");
- flomb = defaultFlomb;
- system("cls");
- for(int i = 0; i < count; i++)
- {
- cout << endl << endl << endl << "\t\t" << flipVertical(flomb);
- Sleep(500);
- system("cls");
- }
- system("color 07");
- }
- string flipHorizontal(string input)
- {
- int size = input.length();
- flomb = string(input.rbegin(), input.rend());
- for(int i = 0; i < size; i++)
- {
- switch(flomb[i])
- {
- case '\\':
- flomb.replace(i, 1, 1, '/');
- break;
- case '/':
- flomb.replace(i, 1, 1, '\\');
- break;
- case '(':
- flomb.replace(i, 1, 1, ')');
- break;
- case ')':
- flomb.replace(i, 1, 1, '(');
- break;
- default:
- break;
- }
- }
- return flomb;
- }
- string flipVertical(string input)
- {
- int size = input.length();
- flomb.clear();
- for(int i = 0; i < size; i++)
- {
- switch(input[i])
- {
- case '\\':
- flomb.replace(i, 1, 1, '/');
- break;
- case '/':
- flomb.replace(i, 1, 1, '\\');
- break;
- default:
- flomb.replace(i, 1, input, i, 1);
- break;
- }
- }
- return flomb;
- }
- void dance(string input, int count)
- {
- system("color 0c");
- flomb = defaultFlomb;
- system("cls");
- for(int i = 0; i < count; i++)
- {
- for(int j = 0; j < 2; j++)
- {
- cout << endl << endl << endl << "\t\t" << flipVertical(flomb);
- Sleep(500);
- system("cls");
- }
- cout << endl << endl << endl << "\t\t" << flipHorizontal(flomb);
- Sleep(500);
- system("cls");
- }
- system("color 07");
- }
- void rave(string input, int count)
- {
- system("color 0c");
- flomb = defaultFlomb;
- system("cls");
- for(int i = 0; i < count; i++)
- {
- switch(i)
- {
- case 1: case 6: case 11:
- system("color 7d");
- break;
- case 2: case 7: case 12:
- system("color 5a");
- break;
- case 3: case 8: case 13:
- system("color 3f");
- break;
- case 4: case 9: case 14:
- system("color 6d");
- break;
- case 5: case 10: case 15:
- system("color 49");
- break;
- }
- for(int j = 0; j < 2; j++)
- {
- cout << endl << endl << endl << "\t\t" << flipVertical(flomb);
- Sleep(50);
- system("cls");
- }
- cout << endl << endl << endl << "\t\t" << flipHorizontal(flomb);
- Sleep(50);
- system("cls");
- }
- system("color 07");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement