0
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<Windows.h>
#include<conio.h>
int main(){
//welcome Heading
printf("\t\t\t``````````````````````````````````````````````````````````````\n");
printf("\t\t\t\tWelcome to The Bank Management System\n\n");
printf("\t\t\t``````````````````````````````````````````````````````````````\n\n");
//password input and validation
char pass[10],password[10]="pass";
int i;
printf("Please Enter Password....");
fflush(stdin);
gets(pass);
    if (strcmp(pass,password)==0){
        printf("WELCOME \nLoading");
        for(i=0;i<5;i++){
            printf(".");
            Sleep(1000);
        }
    }
    else{
        printf("incorrect password");
        getche();
        system("tput clear");
        system("cls");
        system("clear");
        main();
    }
return 0;
}

How to Clear screen in C programming I'm U using dev c but everything I try seems to failed I have included many different libraries but none seems to be working.

young1076
  • 3
  • 1

1 Answers1

0

You seem to be using conio.h. I suggest reading its documentation. It might be downloadable from Microsoft here, if you don't find it elsewhere.

For clearing the screen, it has clrscr() function. Use that to clear the screen.


Note that there are quite a lot of other things wrong with your code, including:

  • Don't ever use gets(), use eg. fgets.
  • Don't call main() recursively, use a loop.
  • Don't use conio.h, use curses library or direct Windows Win32 API calls if stdio.h isn't enough.
  • Avoid using system() for much of anything.
  • Always check for errors when you read user input (or files).

But don't stress about it until later...

hyde
  • 60,639
  • 21
  • 115
  • 176