/**$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*$
$*% PROGRAMMER NAME: BRANDON WALL *$%
%*$ DATE: 4-21-06 %*$
*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$**/
// Chapter 2 | Exercise 1 (Using Switch)
#include <string>
#include <iostream>
#include <ctime>
#include <windows.h>
#include <cstdlib>
using namespace std;
int main()
{
//Sets Difficulty Levels
enum diffs {EASY, NORMAL, HARD};
diffs myDiff;
//Gets Users Choice
int diff;
cout << "*******************************\n"
<< "** **\n"
<< "** Difficulty Levels **\n"
<< "** **\n"
<< "*******************************\n\n"
<< "1) Easy\n"
<< "2) Normal\n"
<< "3) Hard\n\n"
<< "Your Selection ";
cin >> diff;
//Switch Loop
switch (diff)
{
case 1:
//Sets NEW Difficulty
myDiff = EASY;
//Tells user Selection
cout << "\n\nDifficulty Set to Easy.";
//Delay for 2 Seconds
Sleep(2000);
//Clear Screen For ending
system("CLS");
break;
case 2:
//Sets NEW Sifficulty
myDiff = NORMAL;
//Tells user
cout << "\n\nDifficulty Set to Normal.";
//Delay for 2 Seconds
Sleep(2000);
//Ends
system("CLS");
break;
case 3:
//Sets NEW Difficulty
myDiff = HARD;
//Tells user
cout << "\n\nDifficulty Set to Hard.\n\n";
//Delays for 2 seconds
Sleep(2000);
//Ends
system("CLS");
break;
default:
//Tells user that isnt acceptable
cout << "\n\nSorry, That isn't an Option";
//Delays for 2 Seconds
Sleep(2000);
//Clears screen
system("CLS");
//Takes user back to the menu to enter a Valid Option
main();
break;
}
return 0;
}
/**$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*$
$*% PROGRAMMER NAME: BRANDON WALL *$%
%*$ DATE: 4-19-06 %*$
*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$*%$**/
// Shimmer Inc. DataBase
#include <string>
#include <iostream>
#include <windows.h>
using namespace std;
void menu( int& output )
{
cout << "\t\t\t+ Welcome to Shimmers Inc. +\n\n"
<< "***************************************************\n"
<< "** **\n"
<< "** Navigation: **\n"
<< "** 1) Create New Shimmer Account **\n"
<< "** 2) Log In With Existing Shimmer Account **\n"
<< "** 3) Exit **\n"
<< "** **\n"
<< "***************************************************\n\n"
<< "Please Make Your Selection: ";
cin >> output;
}
void poop()
{
int menuSelection;
//Declaire Variables
string userName;
string password;
string name;
string email;
string logName;
string logPass;
//Declaires the menu function
menu(menuSelection);
if(menuSelection == 1)
{
//Clears screen for users info
system("cls");
//username
//Gets users new account info
cout << "*Setp 1*\n\n";
cout << "1) Please enter Your New Username (One Word): ";
cin >> userName;
//password
cout << "2) Please enter Your Account Pssword: ";
cin >> password;
//name
cout << "\n\n*Step 2*\n\n"
<< "1) First Name: ";
cin >> name;
//email
cout << "2) Email Address: ";
cin >> email;
//Thank you ending
cout << "\nThank You.";
Sleep(2000);
//clear screen for loading message
system("cls");
//Loading message
cout << "\t\t\t\tL";
Sleep(1000);
cout << "O";
Sleep(1000);
cout << "A";
Sleep(1000);
cout << "D";
Sleep(1000);
cout << "I";
Sleep(1000);
cout << "N";
Sleep(1000);
cout << "G\n\n";
Sleep(2000);
//Waits for user to cont.
system("cls");
//Gives final Summary
cout << "Thank Your for Choosing Shimmer!\n"
<< "Heres Your Account Info: \n\n"
<< "Account Name: "
<< userName
<< "\nPassword: "
<< password
<< "\n\nPlease Write your Account Information Down Incase you Forget.\n"
<< "Please Log In when you are Transfered to the Menu Screen.\n\n\n";
system("pause");
system("cls");
menu(menuSelection);
}
if(menuSelection == 2)
{
//Tells user to enter their account name
system("cls");
cout << "********************************\n"
<< "** **\n"
<< "** Shimmer Sccount Log In **\n"
<< "** **\n"
<< "********************************\n\n"
<< "Account Name: ";
cin >> logName;
//Tells user to enter their account password
cout << "Password: ";
cin >> logPass;
if(logName != userName && logPass != password)
{
cout << "\n\nAccess Denied.\n\n";
//Delays for another try
Sleep(2000);
system("cls");
poop();
}
if(logName == userName && logPass == password)
{
cout << "\nWelcome, "
<< name
<< "\n\n";
//waits for user to exit
system("pause");
}
}
else if(menuSelection == 3)
{
cout << "\n\nOk, Bye.\n\n";
Sleep(1000);
}
else
{
cout << "\n\nThats not an Option. Bye\n\n";
Sleep(1000);
}
}
int main()
{
poop();
return 0;
}