Advertisement
Guest User

Untitled

a guest
May 30th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.61 KB | None | 0 0
  1. #include <stdio.h> // inkludiert eine C Library
  2. #include <conio.h> // eine weitere
  3.  
  4. int main(void)
  5. {
  6.     int eingabe1;
  7.     int eingabe2;
  8.     int username;
  9.     int password;
  10.    
  11.     username = 742183; // dem int "username" wird eine Zahl zugewiesen
  12.     password = 821590; // dem int "password" wird eine Zahl zugewiesen
  13.  
  14.    
  15.     printf("Username:\n"); //Username wird abgefragt    
  16.     scanf("%d", &eingabe1); // Eingabe des Users wird zu "eingabe1" zugewiesen
  17.     printf("Password:\n"); // Passwort wird abgefragt
  18.     scanf("%d", &eingabe2); // Eingabe des Users wird zu "eingabe2" zugwiesen
  19.  
  20.    
  21.     if(eingabe1==username) // wenn "eingabe1" 12 ist dann.....
  22.     {
  23.                 printf("Username is correct!\n"); // wird auf dem Bildschirm "Username is correct" ausgegeben
  24.                 }
  25.                 else if(eingabe1!=username) // wenn sie jedoch nicht 12 ist
  26.                 {
  27.                 printf("Error: The Username you entered is incorrect\n");  // dann wird "The username you entered is incorrect" auf dem Bildschirm ausgegeben                          
  28.                 }
  29.                                
  30.                                 while(eingabe1!=username) // wenn die eingabe nicht 12 ist dann
  31.                                  {
  32.                                  printf("Username:\n"); // aktiviert sich der while loop und der Username wird erneut abgefragt
  33.                                  scanf("%d", eingabe1); // die eingabe des users wird "eingabe1" zugewiesen
  34.                                  }
  35.                                                    
  36.     if(eingabe2==password) // wenn "eingabe2" 11 ist dann...
  37.                 {
  38.                 printf("Password is correct,succesfully logged in!\n"); // wird "password is correct,succesfully logged in!" ausgegeben
  39.                 }
  40.                                                                    
  41.                 else if(eingabe2!=password) // wenn sie jedoch nicht 11 ist dann
  42.                 {
  43.                 printf("Error: The Password you entered is incorrect!\n"); // wird "The Password you entered is incorrect!" ausgegeben
  44.                 }
  45.                
  46.                 while(eingabe1 || eingabe2 != username || password)
  47.                 {
  48.                 printf("\n\n\n You entered invalid Information, the Application will terminate itself");
  49.                 }
  50.                                
  51.                                                                                    
  52.     getch(); // wartet auf einen tastendruck um das programm zu beenden
  53.     return 0; // das programm wird jetzt beendet/ ist beendet wordern
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement