Mar 26, 2013 at 5:17pm Mar 26, 2013 at 5:17pm UTC
Trying to make where user has to enter 7 characters to make password having trouble with this if statement
if (password2[7])
{
cout << "Please Enter at least 7 characters\n";
goto repeat3;
}
#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
char username1;
char username2[6];
int Login;
int User()
{
cout << "Please Enter a User Id\n";
cout << "User Id must be at least 6 characters long\n";
repeat1:
cin >> username2;
if (username2[6] <= username1)
{
cout << "Please ReEnter Id Not enough characters\n";
goto repeat1;
}
else
cout << "Your User Id is "<< username2 << endl;
}
int Pass()
{
cout << "Please Enter your password\n";
cout << "Your password must be at least 7 characters long\n";
repeat3:
repeat2:
string password1;
string password2;
cin >> password1;
cout << "Please ReEnter your password\n";
cin >> password2;
if (password1 != password2)
{
cout << "You have ReEnter your password incorrectly \n";
goto repeat2;
}
if (password2[7])
{
cout << "Please Enter at least 7 characters\n";
goto repeat3;
}
else
cout << "You Now logged on to treasure Island\n";
}
int Welcome()
{
cout << "Welcome to Adam's Quiz Game\n";
cout << "Login Enter 1 " "Create New Account Enter 2 \n" "Press 3 to Quit\n";
cin >> Login;
if (Login == 2)
{
User();
Pass();
}
if (Login ==1)
{
cout << "bye\n";
}
}
int main()
{
Welcome ();
//ofstream dataFile;
//dataFile.open("data.txt", ios::in|ios::binary|ios::ate);
//dataFile << username1;
//dataFile.close();
system("PAUSE");
return 0;
}