Posted By

Desoxena on 01/11/11


Tagged


Versions (?)

TASKMASTER360 V1.5


 / 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.

  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <string>
  4. #include <algorithm>
  5. #include <fstream>
  6.  
  7. using namespace std;
  8.  
  9. //This is the TASKMASTER360. It is capable of 8 little applications, coded by Me.
  10.  
  11. //--------------------------------------------------------------------------------------------------
  12.  
  13. void listMaker()
  14. {
  15. string item;
  16. int i, j, f;
  17. cout << "how many items are on your list?" << endl;
  18. cin >> i;
  19. string myList[i];
  20. for (f=0;f<i;f++) {
  21. cin >> item;
  22. myList[f] = item;
  23. system("cls");
  24. }
  25. for (j=0;j<i;j++) {
  26. cout << j << ". " << myList[j] << endl;
  27. }
  28. system ("pause");
  29. }
  30.  
  31.  
  32.  
  33. //--------------------------------------------------------------------------------------------------
  34. void logWriteTo()
  35. {
  36. ofstream myLog;
  37. string command;
  38. string logWrite;
  39. int i;
  40. myLog.open("log.txt", ios::app);
  41. cout << "new entry?" << endl;
  42. cin >> command;
  43. if (command == "yes")
  44. {
  45. system("cls");
  46. cin >> logWrite;
  47. for (i=0; i<logWrite.length(); i++) {
  48. if (logWrite.at(i) == '.'||logWrite.at(i) == '_'||logWrite.at(i) == '/')
  49. {
  50. logWrite.replace(i, 1, " ");
  51. }
  52. }
  53. myLog << ">>> " << logWrite << "\n\n";
  54. }
  55. myLog.close();
  56. ;
  57. }
  58. void logView()
  59. {
  60. cout << "your recent entries:\n\n\n" << endl;
  61. system("cls");
  62. string line;
  63. ifstream myLog ("log.txt");
  64. if (myLog.is_open())
  65. {
  66. while ( myLog.good() )
  67. {
  68. getline (myLog, line);
  69. cout << line << endl;
  70. }
  71. myLog.close();
  72. system("pause");
  73. }
  74. }
  75.  
  76. void logWriter()
  77. {
  78. string command;
  79. cout << "would you like to use the logwriter?" << endl;
  80. cin >> command;
  81. if (command == "yes")
  82. {
  83. logWriteTo();
  84. logView();
  85. }
  86. }
  87.  
  88.  
  89.  
  90.  
  91.  
  92. //--------------------------------------------------------------------------------------------------
  93.  
  94.  
  95. void translator()
  96. {
  97. system("cls");
  98. cout << "enter in a string to be translated to binary! (NO SPACES; instead use -'s or .'s)" << endl;
  99. int i=0, j;
  100. string word;
  101. cin >> word;
  102. do{
  103. if(word.at(i) == 'a'||
  104. word.at(i) == 'e'||
  105. word.at(i) == 'i'||
  106. word.at(i) == 'o'||
  107. word.at(i) == 'u')
  108. {
  109. word.replace(i, 1, "0");
  110. i++;
  111. }
  112. else if(word.at(i) == 'b'||
  113. word.at(i) == 'c'||
  114. word.at(i) == 'd'||
  115. word.at(i) == 'f'||
  116. word.at(i) == 'g'||
  117. word.at(i) == 'h'||
  118. word.at(i) == 'j'||
  119. word.at(i) == 'k'||
  120. word.at(i) == 'l'||
  121. word.at(i) == 'm'||
  122. word.at(i) == 'n'||
  123. word.at(i) == 'p'||
  124. word.at(i) == 'q'||
  125. word.at(i) == 'r'||
  126. word.at(i) == 's'||
  127. word.at(i) == 't'||
  128. word.at(i) == 'v'||
  129. word.at(i) == 'w'||
  130. word.at(i) == 'x'||
  131. word.at(i) == 'y'||
  132. word.at(i) == 'z')
  133. {
  134. word.replace(i, 1, "1");
  135. i++;
  136. }
  137. else if(word.at(i) == ' '||word.at(i) == '-'||word.at(i) == '.')
  138. {
  139. word.replace(i, 1, " ");
  140. i++;
  141. }
  142. system("cls");
  143. cout << word << endl;
  144. }while (i != word.length());
  145. system("pause");
  146. }
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153. //----------------------------------------------------------------------------------------------------
  154. void calendar()
  155. {
  156. system("cls");
  157. cout << " CALENDAR" << endl;
  158.  
  159. cout << " S M T W H F S" << endl;
  160. cout << "-----------------------------"<< endl;
  161. cout << "| / | / | 1 | 2 | 3 | 4 | 5 |"<< endl;
  162. cout << "-----------------------------"<< endl;
  163. cout << "| 4 | 5 | 6 | 7 | 8 | 9 | 10|"<< endl;
  164. cout << "-----------------------------"<< endl;
  165. cout << "| 11| 12| 13| 14| 15| 16| 17|"<< endl;
  166. cout << "-----------------------------"<< endl;
  167. cout << "| 18| 19| 20| 21| 22| 23| 24|"<< endl;
  168. cout << "-----------------------------"<< endl;
  169. cout << "| 25| 26| 27| 28| 29| 30| 31|"<< endl;
  170. cout << "-----------------------------"<< endl;
  171. system("pause");
  172. }
  173.  
  174.  
  175.  
  176.  
  177. //-----------------------------------------------------------------------------------------------------
  178.  
  179. void stringReverser()
  180. {
  181. system("cls");
  182. cout << "\nPlease enter in a string to be reversed(NO SPACES)\n" << endl;
  183. int i, j;
  184. string oldstr;
  185. cin >> oldstr;
  186. cout << "\n";
  187. for (i=oldstr.size()-1;i>-1;i--) {
  188. for (j=0;j<oldstr.size();j++) {
  189. if (oldstr.at(j) == '.'||oldstr.at(j) == '_')
  190. {
  191. oldstr.replace(j, 1, " ");
  192. }
  193. }
  194. cout << oldstr.at(i);
  195. }
  196. cout << "\n" << endl;;
  197. cin.get();
  198. system("pause");
  199. }
  200.  
  201.  
  202. //------------------------------------------------------------------------
  203. void calculator()
  204. {
  205. system("cls");
  206. float x, y;
  207. cout << "\nplease input a number.\n" << endl;
  208. cin >> x;
  209. cout << "\nplease input another number.\n" << endl;
  210. cin >> y;
  211. cout << "\n\n" << x << " + " << y << " equals " << x+y << endl;
  212. cout << "------------addition-------------------------" << endl;
  213. cout << "\n\n" << x << " * " << y << " equals " << x*y << endl;
  214. cout << "------------multiplication-------------------" << endl;
  215. cout << "\n\n" << x << " - " << y << " equals " << x-y << endl;
  216. cout << "------------subtraction---------------------" << endl;
  217. cout << "\n\n" << x << " / " << y << " equals " << x/y << endl;
  218. cout << "------------division------------------------" << endl;
  219. system("pause");
  220.  
  221. }
  222. //-------------------------------------------------------------------------
  223. void ticTacToe()
  224. {
  225. system("cls");
  226. int x = 4;
  227. string p1, p2;
  228. string l1 = " | |\n";
  229. string l2 = " | | \n";
  230. string l3 = " ----|----|----\n";
  231. string l4 = " | | \n";
  232. string l5 = " ----|----|----\n";
  233. string l6 = " | | \n";
  234. string l7 = " | |\n";
  235. string l8 = "player1 = X\nplayer2 = O";
  236. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << l8 << endl;
  237. do{
  238. cin >> p1;
  239. if (p1 == "x1"||p1 == "1x")
  240. {
  241. system("cls");
  242. l2.replace(4, 1, "X");
  243. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  244. }
  245. else if(p1 == "x2"||p1=="2x")
  246. {
  247. system("cls");
  248. l2.replace(9, 1, "X");
  249. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  250. }
  251. else if(p1 == "x3"||p1 == "3x")
  252. {
  253. system("cls");
  254. l2.replace(14, 1, "X");
  255. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  256. }
  257. else if(p1 == "x4"||p1 == "4x")
  258. {
  259. system("cls");
  260. l4.replace(4, 1, "X");
  261. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  262. }
  263. else if(p1 == "x5"||p1 == "5x")
  264. {
  265. system("cls");
  266. l4.replace(9, 1, "X");
  267. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  268. }
  269. else if(p1 == "x6"||p1 == "6x")
  270. {
  271. system("cls");
  272. l4.replace(14, 1, "X");
  273. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  274. }
  275. else if(p1 == "x7"||p1 == "7x")
  276. {
  277. system("cls");
  278. l6.replace(4, 1, "X");
  279. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  280. }
  281. else if(p1 == "x8"||p1 == "8x")
  282. {
  283. system("cls");
  284. l6.replace(9, 1, "X");
  285. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  286. }
  287. else if(p1 == "x9"||p1 == "9x")
  288. {
  289. system("cls");
  290. l6.replace(14, 1, "X");
  291. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  292. }
  293. if (p1 == "o1"||p1 == "1o")
  294. {
  295. system("cls");
  296. l2.replace(4, 1, "O");
  297. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  298. }
  299. else if(p1 == "o2"||p1=="2o")
  300. {
  301. system("cls");
  302. l2.replace(9, 1, "O");
  303. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  304. }
  305. else if(p1 == "o3"||p1 == "3o")
  306. {
  307. system("cls");
  308. l2.replace(14, 1, "O");
  309. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  310. }
  311. else if(p1 == "o4"||p1 == "4o")
  312. {
  313. system("cls");
  314. l4.replace(4, 1, "O");
  315. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  316. }
  317. else if(p1 == "o5"||p1 == "5o")
  318. {
  319. system("cls");
  320. l4.replace(9, 1, "O");
  321. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  322. }
  323. else if(p1 == "o6"||p1 == "6o")
  324. {
  325. system("cls");
  326. l4.replace(14, 1, "O");
  327. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  328. }
  329. else if(p1 == "o7"||p1 == "7o")
  330. {
  331. system("cls");
  332. l6.replace(4, 1, "O");
  333. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  334. }
  335. else if(p1 == "o8"||p1 == "8o")
  336. {
  337. system("cls");
  338. l6.replace(9, 1, "O");
  339. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  340. }
  341. else if(p1 == "o9"||p1 == "9o")
  342. {
  343. system("cls");
  344. l6.replace(14, 1, "O");
  345. cout << l1 << l2 << l3 << l4 << l5 << l6 << l7 << endl;
  346. }
  347. else if(p1 == "back")
  348. {
  349. system("pause");
  350. }
  351. else if(p1 == "newgame")
  352. {
  353. system("cls");
  354. ticTacToe();
  355. cout << "\n\n\n";
  356. }
  357. } while(p1 != "back");
  358. }
  359.  
  360.  
  361. void newGame()
  362. {
  363. ticTacToe();
  364. }
  365. void tictacToe()
  366. {
  367. string call;
  368. cout << "*-------------*" << endl;
  369. cout << "| TIC-TAC-TOE |" << endl;
  370. cout << "*-------------*" << endl;
  371. cin >> call;
  372. if (call == "newgame")
  373. {
  374. newGame();
  375. }
  376. else if(call == "back")
  377. {
  378. system("pause");
  379. }
  380. }
  381. //----------------------------------------------------------------------------------
  382.  
  383.  
  384. void myAni()
  385. {
  386. int i=1;
  387. do{
  388. system("cls");
  389. cout << "*_________";
  390. }while(i==2);
  391. do{
  392. system("cls");
  393. cout << "_*________";
  394. }while(i==2);
  395. do{
  396. system("cls");
  397. cout << "__*_______";
  398. }while(i==2);
  399. do{
  400. system("cls");
  401. cout << "___*______";
  402. }while(i==2);
  403. do{
  404. system("cls");
  405. cout << "____*_____";
  406. }while(i==2);
  407. do{
  408. system("cls");
  409. cout <<"_____*____";
  410. }while(i==2);
  411. do{
  412. system("cls");
  413. cout << "______*___";
  414. }while(i==2);
  415. do{
  416. system("cls");
  417. cout << "_______*__";
  418. }while(i==2);
  419. do{
  420. system("cls");
  421. cout << "________*_";
  422. }while(i==2);
  423. do{
  424. system("cls");
  425. cout << "_________*";
  426. }while(i==2);
  427. }
  428. void animation()
  429. {
  430. int i;
  431. for(i=0;i<10;i++) {
  432. myAni();
  433. }
  434.  
  435. }
  436. //----------------------------------------------------------------------------------------------
  437.  
  438.  
  439.  
  440.  
  441. void taskMaster()
  442. {
  443. system("cls");
  444. string call;
  445. cout << "hello Evan! What would you like to do?" << endl;
  446. cout << "here is a list of things i can do!\n" << endl;
  447. cout << "1. calculator" << endl;
  448. cout << "2. animation thing" << endl;
  449. cout << "3. string reverser" << endl;
  450. cout << "4. tictactoe" << endl;
  451. cout << "5. calendar" << endl;
  452. cout << "6. binary translator" << endl;
  453. cout << "7. Logbook" << endl;
  454. cout << "8. Listmaker" << endl;
  455. cout << "-----------------------------------------------------------\n-----------------------------------------------------------" << endl;
  456. cin >> call;
  457. if (call == "1"||call == "calc"||call == "calculator")
  458. {
  459. calculator();
  460. }
  461. else if(call == "2"||call == "animation")
  462. {
  463. animation();
  464. }
  465. else if(call == "3"||call == "string_reverser"||call == "stringreverser")
  466. {
  467. stringReverser();
  468. }
  469. else if(call == "4"||call == "tictactoe")
  470. {
  471. tictacToe();
  472. }
  473. else if(call == "5"||call == "cal"||call == "calendar")
  474. {
  475. calendar();
  476. }
  477. else if(call == "7"||call == "logwriter"||call == "log")
  478. {
  479. logWriter();
  480. }
  481. else if(call == "8"||call == "list"||call == "listmaker"||call == "listwriter")
  482. {
  483. listMaker();
  484. }
  485. else if(call == "6"||call == "translator")
  486. {
  487. translator();
  488. }
  489. 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");
  490. {
  491. taskMaster();
  492. }
  493. }
  494. //---------------------------------------------------------------------
  495.  
  496.  
  497.  
  498. //---------------------------------------------------------------------
  499. int main()
  500. {
  501. string password;
  502. cout << "*---------------------------*" << endl;
  503. cout << "| TASKMASTER360(v1.3) LOGIN |" << endl;
  504. cout << "*---------------------------*" << endl;
  505. cin >> password;
  506. if (password == "happy")
  507. {
  508. taskMaster();
  509.  
  510. }
  511. else if(password != "happy")
  512. {
  513. cout << "WRONG PASSWORD" << endl;
  514. system("pause");
  515. return EXIT_SUCCESS;
  516. }
  517.  
  518. void goBack();
  519. {
  520. int i = 2;
  521. do{
  522. string back;
  523. cout << "do you wish to go back?" << endl;
  524. cin >> back;
  525. if(back == "yes"||back == "Yes"||back == "back")
  526. {
  527. taskMaster();
  528. }
  529. }while(i == 2);
  530. }
  531. }

Report this snippet  

You need to login to post a comment.