Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[])
- {
- string password = "Admin123", inmatning;
- int svar, value = 1, inloggad = 0, forsok = 4;
- while(value == 1){
- if(forsok == 0) {
- inloggad = 0;
- value = 0;
- }
- else{
- cout<<"Skriv ditt losenord."<<endl;
- cin>>inmatning;
- if(inmatning == password) {
- inloggad = 1;
- value = 0;
- forsok = forsok;
- cout<<"Du ar nu inloggad, vad vill du gora nu?"<<endl;
- }
- else {
- if(inmatning != password)
- if(forsok > 0) {
- forsok = forsok - 1;
- inloggad = 0;
- value = 1;
- }
- if(forsok > 0) {
- cout<<"Fel losenord, forsok igen.("<<forsok<<" forsok kvar)"<<endl<<endl;
- }
- else
- if(forsok == 0) {
- value = 0;
- cout<<"Du har inga forsok kvar, programmet kommer nu att avslutas."<<endl;
- }
- }
- }
- }
- cout<<endl;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement