Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <ctime>
- #include <windows.h>
- using namespace std;
- void breakTime( int seconds)
- {
- clock_t temp;
- temp = clock () + seconds * CLOCKS_PER_SEC ;
- while (clock() < temp) {}
- }
- int main(void) {
- string final = "";
- int num1;
- string option = "";
- int num2;
- string user = "";
- string pass = "";
- string yesorno = "";
- reLogin:
- system("color 0F");
- cout << "Username: ";
- cin >> user;
- cout << "\nPassword: ";
- cin >> pass;
- if(user == "Mizaki" && pass == "test123"){
- cout << "\n\n\nLogin successful.. Redirecting you in 5 seconds!";
- breakTime(5);
- system("cls");
- goto main;
- }else{
- failed:
- cout << "Login failed, do you wish to try again? ( yes/no ) ";
- cin >> yesorno;
- if(yesorno == "yes"){
- goto reLogin;
- return 0;
- }
- if(yesorno == "no"){
- cout << "Goodbye!";
- return 0;
- }else{
- goto failed;
- }
- main:
- cout << "Enter number one: ";
- cin >> num1;
- fail:
- cout << "\nEnter your option ( + / - ): ";
- cin >> option;
- cout << "\nEnter number two: ";
- cin >> num2;
- if(option == "+"){
- num1 + num2 = final;
- cout << "Your final product is " << final << endl;
- return 0;
- }
- if(option == "-"){
- num1 - num2 = final;
- cout << "Your final product is " << final << endl;
- return 0;
- }else{
- cout << "Please enter a valid option..\n\n Redirecting you back to the option for you to retry in 5 seconds";
- breakTime(5);
- goto fail;
- return 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement