Commit aeef1f62 by ilahma

Upload New File

parent 82240b0b
Showing with 67 additions and 0 deletions
#include <stdio.h>
#include <string.h>
void readdata(char name[6][20],char password[6][20], char status[6][20], char balance[6][20]);
int nameValidate(char name[20], char names[6][20]);
int passwordValidate(char password[20], char password[6][20])
int main() {
char names[6][20];
char name[15];
char passwords[6][20];
char password[15];
char account_statuses[6][20];
char account_balances[6][20];
int index;
readdata(names,passwords,account_statuses, account_balances);
do {
printf("Enter name and password");
scanf("%s",name);
scanf("%s",password);
index=nameValidate(name, names);
} while(index<0);
printf("%d", index);
return 0;
}
void readdata( char name[6][20], char password[6][20], char status[6][20], char balance[6][20]) {
int i;
for(i=0; i<6;i++) {
scanf("%s%s%s%s", name[i],password[i],status[i],balance[i]);
}
}
int nameValidate(char name[20], char names[6][20]) {
int i;
for(i=0;i<6;i++) {
if(strcmp(name, names[i])==0) {
return i;
}
}
return -1;
}
int passwordValidate(char password[20], char password[6][20]) {
int i;
for(i=0;i<6;i++) {
if(strcmp(password, password[i])==0) {
return i;
}
}
return -1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment