Advertisement
Guest User

Virus? C++ Program

a guest
Feb 17th, 2016
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main()
  10. {
  11.     //Strings:
  12.    
  13.    
  14.     string day;
  15.     string rday;
  16.     string action;
  17.     string monday;
  18.     string insidemonday;
  19.     string tuesday;
  20.     string insidetuesday;
  21.     string wednesday;
  22.     string insidewednesday;
  23.     string thursday;
  24.     string insidethursday;
  25.     string friday;
  26.     string insidefriday;
  27.     string saturday;
  28.     string insidesaturday;
  29.     string sunday;
  30.     string insidesunday;
  31.  
  32.  
  33.     //Program Start:
  34.    
  35.  
  36. backtostart:
  37.     cout << "                          Welcome to LifePrint V1";
  38.     cout << "\n \n";
  39.     cout << "What would you like to do? (Write/Read)\n";
  40.     getline(cin, action);
  41.  
  42.     //Action: WRITE
  43.    
  44.     if (action == "Write" | action == "write")
  45.     {
  46.     backtowrite:
  47.         cout << "Please enter the Day you want to write in.\n";
  48.         getline(cin, day);
  49.  
  50.  
  51.         if (day == "monday" | day == "Monday")
  52.  
  53.         {
  54.             system("cls");
  55.             cout << "                          Welcome to LifePrint V1";
  56.             cout << "\n \n";
  57.             cout << "Welcome to Monday, You can now start writing Below:\n";
  58.             getline(cin, monday, '\0');
  59.             system("pause");
  60.             cout << "\n";
  61.            
  62.             ofstream monfile("Monday.dat");
  63.             if (monfile.is_open())
  64.  
  65.             {
  66.                 monfile << monday;
  67.                 monfile.close();
  68.                 cout << "Your day was saved Successfully!\n";
  69.                 system("pause");
  70.                 return 0;
  71.             }
  72.  
  73.             else { cout << "Can't Open File\n"; }
  74.         }
  75.  
  76.         if (day == "Tuesday" | day == "tuesday")
  77.  
  78.         {
  79.             system("cls");
  80.             cout << "                          Welcome to LifePrint V1";
  81.             cout << "\n \n";
  82.             cout << "Welcome to Tuesday, You can now start writing Below:\n";
  83.             getline(cin, tuesday, '\0');
  84.             system("pause");
  85.             cout << "\n";
  86.  
  87.             ofstream tuesfile("Tuesday.dat");
  88.             if (tuesfile.is_open())
  89.  
  90.             {
  91.                 tuesfile << tuesday;
  92.                 tuesfile.close();
  93.                 cout << "Your day was saved Successfully!\n";
  94.                 system("pause");
  95.                 return 0;
  96.             }
  97.  
  98.             else { cout << "Can't Open File\n"; }
  99.         }
  100.  
  101.         if (day == "Wednesday" | day == "wednesday")
  102.  
  103.         {
  104.             system("cls");
  105.             cout << "                          Welcome to LifePrint V1";
  106.             cout << "\n \n";
  107.             cout << "Welcome to Wednesday, You can now start writing Below:\n";
  108.             getline(cin, wednesday, '\0');
  109.             system("pause");
  110.             cout << "\n";
  111.  
  112.             ofstream wedfile("Wednesday.dat");
  113.             if (wedfile.is_open())
  114.  
  115.             {
  116.                 wedfile << wednesday;
  117.                 wedfile.close();
  118.                 cout << "Your day was saved Successfully!\n";
  119.                 system("pause");
  120.                 return 0;
  121.             }
  122.  
  123.             else { cout << "Can't Open File\n"; }
  124.         }
  125.  
  126.         if (day == "Thursday" | day == "thursday")
  127.  
  128.         {
  129.             system("cls");
  130.             cout << "                          Welcome to LifePrint V1";
  131.             cout << "\n \n";
  132.             cout << "Welcome to Thursday, You can now start writing Below:\n";
  133.             getline(cin, wednesday, '\0');
  134.             system("pause");
  135.             cout << "\n";
  136.  
  137.             ofstream thufile("Thursday.dat");
  138.             if (thufile.is_open())
  139.  
  140.             {
  141.                 thufile << thursday;
  142.                 thufile.close();
  143.                 cout << "Your day was saved Successfully!\n";
  144.                 system("pause");
  145.                 return 0;
  146.             }
  147.  
  148.             else { cout << "Can't Open File\n"; }
  149.         }
  150.  
  151.         if (day == "Friday" | day == "friday")
  152.  
  153.         {
  154.             system("cls");
  155.             cout << "                          Welcome to LifePrint V1";
  156.             cout << "\n \n";
  157.             cout << "Welcome to Friday, You can now start writing Below:\n";
  158.             getline(cin, friday, '\0');
  159.             system("pause");
  160.             cout << "\n";
  161.  
  162.             ofstream frifile("Friday.dat");
  163.             if (frifile.is_open())
  164.  
  165.             {
  166.                 frifile << friday;
  167.                 frifile.close();
  168.                 cout << "Your day was saved Successfully!\n";
  169.                 system("pause");
  170.                 return 0;
  171.             }
  172.  
  173.             else { cout << "Can't Open File\n"; }
  174.         }
  175.        
  176.         if (day == "Saturday" | day == "saturday")
  177.  
  178.         {
  179.             system("cls");
  180.             cout << "                          Welcome to LifePrint V1";
  181.             cout << "\n \n";
  182.             cout << "Welcome to Saturday, You can now start writing Below:\n";
  183.             getline(cin, saturday, '\0');
  184.             system("pause");
  185.             cout << "\n";
  186.  
  187.             ofstream satfile("Saturday.dat");
  188.             if (satfile.is_open())
  189.  
  190.             {
  191.                 satfile << saturday;
  192.                 satfile.close();
  193.                 cout << "Your day was saved Successfully!\n";
  194.                 system("pause");
  195.                 return 0;
  196.             }
  197.  
  198.             else { cout << "Can't Open File\n"; }
  199.         }
  200.        
  201.         if (day == "Sunday" | day == "sunday")
  202.  
  203.         {
  204.             system("cls");
  205.             cout << "                          Welcome to LifePrint V1";
  206.             cout << "\n \n";
  207.             cout << "Welcome to Sunday, You can now start writing Below:\n";
  208.             getline(cin, sunday, '\0');
  209.             system("pause");
  210.             cout << "\n";
  211.  
  212.             ofstream sunfile("Sunday.dat");
  213.             if (sunfile.is_open())
  214.  
  215.             {
  216.                 sunfile << sunday;
  217.                 sunfile.close();
  218.                 cout << "Your day was saved Successfully!\n";
  219.                 system("pause");
  220.                 return 0;
  221.             }
  222.  
  223.             else { cout << "Can't Open File\n"; }
  224.         }
  225.        
  226.         //Final else of Write
  227.  
  228.         else
  229.         {
  230.             cout << "That is not a Day of the Week, Try again.\n";
  231.             system("pause");
  232.             cin.clear();
  233.             system("cls");
  234.             goto backtowrite;
  235.         }
  236.     }
  237.  
  238.  
  239.     //Action: READ
  240.    
  241.    
  242.     if (action == "Read" | action == "read")
  243.     {
  244.         backtoread:
  245.         cout << "Please Enter the Day you want to Read:\n";
  246.         getline(cin, rday);
  247.  
  248.         if (rday == "Monday" | rday == "monday")
  249.         {
  250.             ifstream rmonfile("Monday.dat");
  251.             if (rmonfile.is_open())
  252.  
  253.             {
  254.                 std::getline(rmonfile, insidemonday, '\0');
  255.                 system("cls");
  256.                 std::cout << "Monday:\n";
  257.                 std::cout << "\n";
  258.                 std::cout << "\n";
  259.                 std::cout << insidemonday;
  260.                 std::cout << "\n";
  261.                 std::cout << "\n";
  262.                 std::system("pause");
  263.                 rmonfile.close();
  264.                 return 0;
  265.             }
  266.  
  267.             else {
  268.                 std::cout << "Can't open file\n";
  269.                 system("pause");
  270.             }
  271.         }
  272.  
  273.             if (rday == "Tuesday" | rday == "tuesday")
  274.             {
  275.                 ifstream rtuefile("Tuesday.dat");
  276.                 if (rtuefile.is_open())
  277.  
  278.                 {
  279.                     std::getline(rtuefile, insidetuesday, '\0');
  280.                     system("cls");
  281.                     std::cout << "Tuesday:\n";
  282.                     std::cout << "\n";
  283.                     std::cout << "\n";
  284.                     std::cout << insidetuesday;
  285.                     std::cout << "\n";
  286.                     std::cout << "\n";
  287.                     std::system("pause");
  288.                     rtuefile.close();
  289.                     return 0;
  290.                 }
  291.  
  292.                 else {
  293.                     std::cout << "Can't open file\n";
  294.                     system("pause");
  295.                 }
  296.         }
  297.  
  298.             if (rday == "Wednesday" | rday == "wednesday")
  299.             {
  300.                 ifstream rwedfile("Wednesday.dat");
  301.                 if (rwedfile.is_open())
  302.  
  303.                 {
  304.                     std::getline(rwedfile, insidewednesday, '\0');
  305.                     system("cls");
  306.                     std::cout << "Wednesday:\n";
  307.                     std::cout << "\n";
  308.                     std::cout << "\n";
  309.                     std::cout << insidewednesday;
  310.                     std::cout << "\n";
  311.                     std::cout << "\n";
  312.                     std::system("pause");
  313.                     rwedfile.close();
  314.                     return 0;
  315.                 }
  316.  
  317.                 else {
  318.                     std::cout << "Can't open file\n";
  319.                     system("pause");
  320.                 }
  321.             }
  322.  
  323.             if (rday == "Thursday" | rday == "thursday")
  324.             {
  325.                 ifstream rthufile("Thursday.dat");
  326.                 if (rthufile.is_open())
  327.  
  328.                 {
  329.                     std::getline(rthufile, insidethursday, '\0');
  330.                     system("cls");
  331.                     std::cout << "Thursday:\n";
  332.                     std::cout << "\n";
  333.                     std::cout << "\n";
  334.                     std::cout << insidethursday;
  335.                     std::cout << "\n";
  336.                     std::cout << "\n";
  337.                     std::system("pause");
  338.                     rthufile.close();
  339.                     return 0;
  340.                 }
  341.  
  342.                 else {
  343.                     std::cout << "Can't open file\n";
  344.                     system("pause");
  345.                 }
  346.             }
  347.  
  348.             if (rday == "Friday" | rday == "friday")
  349.             {
  350.                 ifstream rfrifile("Friday.dat");
  351.                 if (rfrifile.is_open())
  352.  
  353.                 {
  354.                     std::getline(rfrifile, insidefriday, '\0');
  355.                     system("cls");
  356.                     std::cout << "Friday:\n";
  357.                     std::cout << "\n";
  358.                     std::cout << "\n";
  359.                     std::cout << insidefriday;
  360.                     std::cout << "\n";
  361.                     std::cout << "\n";
  362.                     std::system("pause");
  363.                     rfrifile.close();
  364.                     return 0;
  365.                 }
  366.  
  367.                 else {
  368.                     std::cout << "Can't open file\n";
  369.                     system("pause");
  370.                 }
  371.             }
  372.  
  373.             if (rday == "Saturday" | rday == "saturday")
  374.             {
  375.                 ifstream rsatfile("Saturday.dat");
  376.                 if (rsatfile.is_open())
  377.  
  378.                 {
  379.                     std::getline(rsatfile, insidesaturday, '\0');
  380.                     system("cls");
  381.                     std::cout << "Saturday:\n";
  382.                     std::cout << "\n";
  383.                     std::cout << "\n";
  384.                     std::cout << insidesaturday;
  385.                     std::cout << "\n";
  386.                     std::cout << "\n";
  387.                     std::system("pause");
  388.                     rsatfile.close();
  389.                     return 0;
  390.                 }
  391.  
  392.                 else {
  393.                     std::cout << "Can't open file\n";
  394.                     system("pause");
  395.                 }
  396.             }
  397.  
  398.            
  399.             if (rday == "Sunday" | rday == "sunday")
  400.             {
  401.                 ifstream rsunfile("Sunday.dat");
  402.                 if (rsunfile.is_open())
  403.  
  404.                 {
  405.                     std::getline(rsunfile, insidesunday, '\0');
  406.                     system("cls");
  407.                     std::cout << "Sunday:\n";
  408.                     std::cout << "\n";
  409.                     std::cout << "\n";
  410.                     std::cout << insidesunday;
  411.                     std::cout << "\n";
  412.                     std::cout << "\n";
  413.                     std::system("pause");
  414.                     rsunfile.close();
  415.                     return 0;
  416.                 }
  417.  
  418.                 else {
  419.                     std::cout << "Can't open file\n";
  420.                     system("pause");
  421.                 }
  422.             }
  423.  
  424.             //Final Else of Write
  425.  
  426.             else {
  427.             cout << "That is not an Available Day, Try again.\n";
  428.             cout << "\n";
  429.             system("pause");
  430.             cin.clear();
  431.             system("cls");
  432.             goto backtoread;
  433.                                                          }
  434.     }
  435.  
  436.           //Final Else of Action
  437.  
  438.     else {
  439.         cout << "That is not an available Action, try again.\n";
  440.         cout << "\n";
  441.         cin.clear();
  442.         system("pause");
  443.         system("cls");
  444.         goto backtostart;
  445.                                                         }
  446. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement