Advertisement
Guest User

errorzzzz

a guest
Jul 14th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4. #include <windows.h>
  5. using namespace std;
  6.  
  7. void breakTime( int seconds)
  8. {
  9.     clock_t temp;
  10.     temp = clock () + seconds * CLOCKS_PER_SEC ;
  11.     while (clock() < temp) {}
  12. }
  13. int main(void) {
  14.     string final = "";
  15.     int num1;
  16.     string option = "";
  17.     int num2;
  18.     string user = "";
  19.     string pass = "";
  20.     string yesorno = "";
  21.     reLogin:
  22.     system("color 0F");
  23.     cout << "Username: ";
  24.     cin >> user;
  25.     cout << "\nPassword: ";
  26.     cin >> pass;
  27.     if(user == "Mizaki" && pass == "test123"){
  28.         cout << "\n\n\nLogin successful.. Redirecting you in 5 seconds!";
  29.         breakTime(5);
  30.         system("cls");
  31.         goto main;
  32.         }else{
  33.         failed:
  34.     cout << "Login failed, do you wish to try again? ( yes/no ) ";
  35.     cin >> yesorno;
  36.     if(yesorno == "yes"){
  37.         goto reLogin;
  38.         return 0;
  39.     }
  40.     if(yesorno == "no"){
  41.         cout << "Goodbye!";
  42.         return 0;
  43.     }else{
  44.     goto failed;
  45.     }
  46.     main:
  47.         cout << "Enter number one: ";
  48.         cin >> num1;
  49.         fail:
  50.         cout << "\nEnter your option ( + / - ): ";
  51.         cin >> option;
  52.         cout << "\nEnter number two: ";
  53.         cin >> num2;
  54.         if(option == "+"){
  55.             num1 + num2 = final;
  56.             cout << "Your final product is " << final << endl;
  57.             return 0;
  58.         }
  59.         if(option == "-"){
  60.             num1 - num2 = final;
  61.             cout << "Your final product is " << final << endl;
  62.             return 0;
  63.         }else{
  64.         cout << "Please enter a valid option..\n\n Redirecting you back to the option for you to retry in 5 seconds";
  65.         breakTime(5);
  66.         goto fail;
  67.         return 0;
  68.         }
  69.  
  70.     }
  71.     return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement