/ Published in: C++
the taskmaster360(v1.5) features 8 apps; calculator, list-writer, logbook, animation thing, tictactoe, string reverser, calendar, binary translator. has a login, and a return function that only works when logged in. it's around 500+ lines.
Expand |
Embed | Plain Text
#include <iostream> #include <cstdlib> #include <string> #include <algorithm> #include <fstream> using namespace std; //This is the TASKMASTER360. It is capable of 8 little applications, coded by Me. //-------------------------------------------------------------------------------------------------- void listMaker() { string item; int i, j, f; cout << "how many items are on your list?" << endl; cin >> i; string myList[i]; for (f=0;f<i;f++) { cin >> item; myList[f] = item; system("cls"); } for (j=0;j<i;j++) { cout << j << ". " << myList[j] << endl; } system ("pause"); } //-------------------------------------------------------------------------------------------------- void logWriteTo() { ofstream myLog; string command; string logWrite; int i; myLog.open("log.txt", ios::app); cout << "new entry?" << endl; cin >> command; if (command == "yes") { system("cls"); cin >> logWrite; for (i=0; i<logWrite.length(); i++) { if (logWrite.at(i) == '.'||logWrite.at(i) == '_'||logWrite.at(i) == '/') { logWrite.replace(i, 1, " "); } } myLog << ">>> " << logWrite << "\n\n"; } myLog.close(); ; } void logView() { cout << "your recent entries:\n\n\n" << endl; system("cls"); string line; ifstream myLog ("log.txt"); if (myLog.is_open()) { while ( myLog.good() ) { getline (myLog, line); cout << line << endl; } myLog.close(); system("pause"); } } void logWriter() { string command; cout << "would you like to use the logwriter?" << endl; cin >> command; if (command == "yes") { logWriteTo(); logView(); } } //-------------------------------------------------------------------------------------------------- void translator() { system("cls"); cout << "enter in a string to be translated to binary! (NO SPACES; instead use -'s or .'s)" << endl; int i=0, j; string word; cin >> word; do{ if(word.at(i) == 'a'|| word.at(i) == 'e'|| word.at(i) == 'i'|| word.at(i) == 'o'|| word.at(i) == 'u') { word.replace(i, 1, "0"); i++; } else if(word.at(i) == 'b'|| word.at(i) == 'c'|| word.at(i) == 'd'|| word.at(i) == 'f'|| word.at(i) == 'g'|| word.at(i) == 'h'|| word.at(i) == 'j'|| word.at(i) == 'k'|| word.at(i) == 'l'|| word.at(i) == 'm'|| word.at(i) == 'n'|| word.at(i) == 'p'|| word.at(i) == 'q'|| word.at(i) == 'r'|| word.at(i) == 's'|| word.at(i) == 't'|| word.at(i) == 'v'|| word.at(i) == 'w'|| word.at(i) == 'x'|| word.at(i) == 'y'|| word.at(i) == 'z') { word.replace(i, 1, "1"); i++; } else if(word.at(i) == ' '||word.at(i) == '-'||word.at(i) == '.') { word.replace(i, 1, " "); i++; } system("cls"); cout << word << endl; }while (i != word.length()); system("pause"); } //---------------------------------------------------------------------------------------------------- void calendar() { system("cls"); cout << " CALENDAR" << endl; cout << " S M T W H F S" << endl; cout << "-----------------------------"<< endl; cout << "| / | / | 1 | 2 | 3 | 4 | 5 |"<< endl; cout << "-----------------------------"<< endl; cout << "| 4 | 5 | 6 | 7 | 8 | 9 | 10|"<< endl; cout << "-----------------------------"<< endl; cout << "| 11| 12| 13| 14| 15| 16| 17|"<< endl; cout << "-----------------------------"<< endl; cout << "| 18| 19| 20| 21| 22| 23| 24|"<< endl; cout << "-----------------------------"<< endl; cout << "| 25| 26| 27| 28| 29| 30| 31|"<< endl; cout << "-----------------------------"<< endl; system("pause"); } //----------------------------------------------------------------------------------------------------- void stringReverser() { system("cls"); cout << "\nPlease enter in a string to be reversed(NO SPACES)\n" << endl; int i, j; string oldstr; cin >> oldstr; cout << "\n"; for (i=oldstr.size()-1;i>-1;i--) { for (j=0;j<oldstr.size();j++) { if (oldstr.at(j) == '.'||oldstr.at(j) == '_') { oldstr.replace(j, 1, " "); } } cout << oldstr.at(i); } cout << "\n" << endl;; cin.get(); system("pause"); } //------------------------------------------------------------------------ void calculator() { system("cls"); float x, y; cout << "\nplease input a number.\n" << endl; cin >> x; cout << "\nplease input another number.\n" << endl; cin >> y; cout << "\n\n" << x << " + " << y << " equals " << x+y << endl; cout << "------------addition-------------------------" << endl; cout << "\n\n" << x << " * " << y << " equals " << x*y << endl; cout << "------------multiplication-------------------" << endl; cout << "\n\n" << x << " - " << y << " equals " << x-y << endl; cout << "------------subtraction---------------------" << endl; cout << "\n\n" << x << " / " << y << " equals " << x/y << endl; cout << "------------division------------------------" << endl; system("pause"); } //------------------------------------------------------------------------- void ticTacToe() { system("cls"); int x = 4; string p1, p2; string l1 = " | |\n"; string l2 = " | | \n"; string l3 = " ----|----|----\n"; string l4 = " | | \n"; string l5 = " ----|----|----\n"; string l6 = " | | \n"; string l7 = " | |\n"; string l8 = "player1 = X\nplayer2 = O"; cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << l8 << endl; do{ cin >> p1; if (p1 == "x1"||p1 == "1x") { system("cls"); l2.replace(4, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x2"||p1=="2x") { system("cls"); l2.replace(9, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x3"||p1 == "3x") { system("cls"); l2.replace(14, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x4"||p1 == "4x") { system("cls"); l4.replace(4, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x5"||p1 == "5x") { system("cls"); l4.replace(9, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x6"||p1 == "6x") { system("cls"); l4.replace(14, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x7"||p1 == "7x") { system("cls"); l6.replace(4, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x8"||p1 == "8x") { system("cls"); l6.replace(9, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "x9"||p1 == "9x") { system("cls"); l6.replace(14, 1, "X"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } if (p1 == "o1"||p1 == "1o") { system("cls"); l2.replace(4, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o2"||p1=="2o") { system("cls"); l2.replace(9, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o3"||p1 == "3o") { system("cls"); l2.replace(14, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o4"||p1 == "4o") { system("cls"); l4.replace(4, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o5"||p1 == "5o") { system("cls"); l4.replace(9, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o6"||p1 == "6o") { system("cls"); l4.replace(14, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o7"||p1 == "7o") { system("cls"); l6.replace(4, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o8"||p1 == "8o") { system("cls"); l6.replace(9, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "o9"||p1 == "9o") { system("cls"); l6.replace(14, 1, "O"); cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl; } else if(p1 == "back") { system("pause"); } else if(p1 == "newgame") { system("cls"); ticTacToe(); cout << "\n\n\n"; } } while(p1 != "back"); } void newGame() { ticTacToe(); } void tictacToe() { string call; cout << "*-------------*" << endl; cout << "| TIC-TAC-TOE |" << endl; cout << "*-------------*" << endl; cin >> call; if (call == "newgame") { newGame(); } else if(call == "back") { system("pause"); } } //---------------------------------------------------------------------------------- void myAni() { int i=1; do{ system("cls"); cout << "*_________"; }while(i==2); do{ system("cls"); cout << "_*________"; }while(i==2); do{ system("cls"); cout << "__*_______"; }while(i==2); do{ system("cls"); cout << "___*______"; }while(i==2); do{ system("cls"); cout << "____*_____"; }while(i==2); do{ system("cls"); cout <<"_____*____"; }while(i==2); do{ system("cls"); cout << "______*___"; }while(i==2); do{ system("cls"); cout << "_______*__"; }while(i==2); do{ system("cls"); cout << "________*_"; }while(i==2); do{ system("cls"); cout << "_________*"; }while(i==2); } void animation() { int i; for(i=0;i<10;i++) { myAni(); } } //---------------------------------------------------------------------------------------------- void taskMaster() { system("cls"); string call; cout << "hello Evan! What would you like to do?" << endl; cout << "here is a list of things i can do!\n" << endl; cout << "1. calculator" << endl; cout << "2. animation thing" << endl; cout << "3. string reverser" << endl; cout << "4. tictactoe" << endl; cout << "5. calendar" << endl; cout << "6. binary translator" << endl; cout << "7. Logbook" << endl; cout << "8. Listmaker" << endl; cout << "-----------------------------------------------------------\n-----------------------------------------------------------" << endl; cin >> call; if (call == "1"||call == "calc"||call == "calculator") { calculator(); } else if(call == "2"||call == "animation") { animation(); } else if(call == "3"||call == "string_reverser"||call == "stringreverser") { stringReverser(); } else if(call == "4"||call == "tictactoe") { tictacToe(); } else if(call == "5"||call == "cal"||call == "calendar") { calendar(); } else if(call == "7"||call == "logwriter"||call == "log") { logWriter(); } else if(call == "8"||call == "list"||call == "listmaker"||call == "listwriter") { listMaker(); } else if(call == "6"||call == "translator") { translator(); } else if (call != "1"||call!="2"||call!="3"||call!="4"||call!="5"||call!="cal"||call!="calc"||call!="calculator"||call!="calendar"||call!="stringreverser"||call!="string_reverser"||call!="animation"||call!="tictactoe"); { taskMaster(); } } //--------------------------------------------------------------------- //--------------------------------------------------------------------- int main() { string password; cout << "*---------------------------*" << endl; cout << "| TASKMASTER360(v1.3) LOGIN |" << endl; cout << "*---------------------------*" << endl; cin >> password; if (password == "happy") { taskMaster(); } else if(password != "happy") { cout << "WRONG PASSWORD" << endl; system("pause"); return EXIT_SUCCESS; } void goBack(); { int i = 2; do{ string back; cout << "do you wish to go back?" << endl; cin >> back; if(back == "yes"||back == "Yes"||back == "back") { taskMaster(); } }while(i == 2); } }
You need to login to post a comment.
