Hello, l sor of scribbled this code up from a few tutorial l have looked over, combining tutorials never works for a newbie to C++ :( now this is what l have written::
// InfoMenu.cpp : main project file.
#include <stdafx.h>
#include <iostream>
#include <string>
using namespace std;
int main()
{
int loop=1;
int choice;
string getinput;
while(loop==1)
{
cout << "Type 'exit' to leave at any time\n"
<< "Type 'login' to begin\n";
cin >> getinput;
if(getinput=="exit") // Exit Code
{
exit(0);
}
if(getinput=="login") // Login Code
cout << "Username:"; // Username Code
cin >> getinput;
if (getinput=="Test")
{
cout << "Passsword:"; // Password Code
cin >> getinput;
if(getinput=="Pass")
cout << "Welcome...";
}
}
}
It is just a menu thing, pretty much first thing l have ever built. Here is what l would like but l dont really have and know how to do.
1. l have an exit code, but this only works in the main menu where you are prompted to type exit or login, how can l get this to work in every writing bit?
2. Secondly l would like to have two different accounts, how can l do this?
3. How can l add a commend after each prompt that if it is not the same as the the (getinput=="~~~") it goes back to the start?
sorry for all the questions but l am sort of confused and lost here...