Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- char name[50]="Alex";
- char password[50]="password";
- int a, b;
- char ai_cont[5];
- int triesLeft=3;
- int triesLeftpassword=3;
- fflush(stdout);
- //ai cont sau nu ai cont?
- printf("Ai cont? Da/Nu -> ");
- fflush(stdout);
- scanf("%s", ai_cont);
- if(strcmp(ai_cont,"da") && strcmp(ai_cont,"Da") == 0){
- printf("Log in: \n");
- //sectiune de login - username
- do{
- printf("username: ");
- fflush(stdout);
- scanf("%s",name);
- a = strcmp(name,"Alex");
- if(a!=0)
- {
- triesLeft--;
- printf("You are not Alex! You have %d tries left!\n", triesLeft);
- }
- if(triesLeft == 0){
- printf("You are not Alex!! Go away!!");
- }
- }while(a != 0 && triesLeft != 0);
- //sectiune de login - password
- if(strcmp(name,"Alex") == 0){
- do{
- printf("password: ");
- fflush(stdout);
- scanf("%s",password);
- b = strcmp(password,"password");
- if(b!=0)
- {
- triesLeftpassword--;
- printf("You are not Alex! You have %d tries left!\n", triesLeftpassword);
- }
- if(triesLeftpassword == 0){
- printf("Wrong password! Acces denied!");
- }
- }while(b != 0 && triesLeftpassword != 0);
- }
- //daca loginul este complet
- if(strcmp(name,"Alex") == 0 && strcmp(password,"password") == 0){
- printf("You enter in your account, Alex!\n\n");
- }
- else{
- return 1;
- }
- //meniul cu optiuni
- printf("1- Media;\n");
- printf("2- Note;\n");
- printf("3- Restante;\n");
- printf("4- Credite;\n");
- printf("5- Date personale.");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement