I was having problems with this program or better with the int main() function. The program is supposed to ask the user for his name and password. After that the user will be able to access different infos based on his security clearing.
The comments in the code are English tho the program itself is in German (long story why its in German ^^)
I shortened the code so it will only work properly for the user "kornelia" and "eduard" (both with high security clearing)
#include <cstdio>
#include <cmath>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
cout << "\t\tNetwork";
//declaring security
int info;
int security = 0;
//getting the Username
string szUsername;
cout <<"\nUsername: ";
cin >> szUsername;
//getting the password
string szPassword;
cout <<"\npassword: " << endl;
cin >> szPassword;
//action for successful loggin of the user "kornelia"
if (szUsername == "kornelia" && szPassword == "lelewel8")
{
cout << "\nHallo Kornelia, dein login war erfolgreich";
security = 5;
}
// action for successful loggin of the user "eduard"
if (szUsername == "eduard" && szPassword == "afkem2009")
{
cout << "\nHallo Eduard, du hast dich erfolgreich eingeloggt";
security = 5;
}
//action for successful loggin of the user "gast"
if (szUsername == "gast" || szPassword == "gast")
{
cout << "\nHerzlich willkommen Gast";
security = 1;
}
//action for wrong name or password
if (!security)
cout << "Ihr loggin ist fehlgeschlagen\n" << endl;
//action for security clearing = 5
if (security == 5)
{
// welcome and basic menu for selecting infos
cout << "Sie haben Sicherheitsstufe 5 (777 Rechte)" << endl;
cout << "Welche Informationen wollen sie erhalten?\n1: Computerpassword Kornelia";
cout << "\n2: Computerpassword Eduard\n3: Routerpassword";
cin << info;
// cout the infos
if (info == 1)
{
cout << "Der Computer besitzt kein Password";
}
if (info == 2)
{
cout << "Das Computerpassword von Eduard lautet: afkem2009";
}
if (info == 3)
{
cout << "Benutzername: admin\nPassword: lelewel8";
}
}
// end
system("PAUSE");
return 0;
}
thank you in advance and please don't just give me a solved program back because I really want to understand what I've done wrong :)