Does anyone know a better way to sign an if statement to an array?
Check out this example:
PHP Code:
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char szopenftp[20];
char szeditftp[20];
char szadminftp[20];
char szpassftp[20];
cout<<" ---------------------------------------- "<<endl;
cout<<" Welcome to 'Cracker Trainer' version 1.0 "<<endl;
cout<<" ---------------------------------------- "<<endl;
cout<<endl;
cout<<" This program is to simulate the ftp on a computer. "<<endl;
cout<<" Please read the readme.txt file before beginning session."<<endl;
cout<<" Developed by: Machewy"<<endl;
cout<<" @copy righted"<<endl;
cout<<" All rights reserved. "<<endl;
cout<<endl;
cout<<endl;
system("PAUSE");
system("CLS");
cout<< "ftp>open ";
cin.getline(szopenftp, 20);
cout<<"_____________________________________________"<<endl;
cout<<"connected to: "<<szopenftp<<endl;
cout<<endl;
cout<<"ftp>";
cin.getline(szeditftp, 20);
cout<<endl;
cout<<"All commands including, "<<szeditftp<<","<<" have been disabled!"<<endl;
cout<<"Please login:"<<endl;
cout<<"User name:";
cin.getline(szadminftp, 20);
if(!strcmpi("Admin", szadminftp))
{
cout<<"Admin Password:";
cin.getline(szpassftp, 20);
if(!strcmpi("coolbeans", szpassftp))
{
system("CLS");
cout<<" Correct Password. ";
system("PAUSE");
}
else
{
cout<<" Invalid Password! "<<endl;
cout<<" Logon failed. "<<endl;
cout<<" disconnecting.... "<<endl;
system("PAUSE");
}
}
else
{
cout<<"Invalid user name!"<<endl;
cout<<"Log on failed."<<endl;
cout<<"disconnecting...."<<endl;
system("PAUSE");
}
return 0;
}
Does anyone know a better way?