char xusername[10]; char xbankname[10]; int xaccountnum[4]; int xcardnum[14]; int xpass[4]; int xwalletnum[11]; int xOTP[4]; printf("Enjoy a range of our banking services including cash withdrawals and deposits, card and loan installment payments, bill payments, smart wallet recharge, and card-less services.\n\n\n"); printf("If you are bank staff press 1. \t\t\t If you are a customer press 2.\n"); int num; label0: scanf_s("%d", &num); if (num == 1) {//bank staff char bank_staff[10] = { "mahmoud" }; char xbank_staff[10]; int bank_pass[4] = { 5,5,5,5 }; int xbank_pass[4]; int doha = 0; labelinf1: printf("Enter your name.\n"); scanf_s("%s", xbank_staff, 10); if (strcmp(xbank_staff, bank_staff) == 0) { printf("Enter your password.\n"); scan_array(xbank_pass, 4); for (int i = 0; i < 4; i++) { if (xbank_pass[i] == bank_pass[i]) { doha++; } else { printf("\aWrong password.\n"); break; } } if (doha == 4) { printf("Enter the name you want to show their data.\n"); char yara[10]; labelinf: scanf_s("%s", yara, 10); if (strcmp(yara, user[0].user_name) == 0) { printf("\n"); print_struct(user[0].user_name, user[0].bank_name, user[0].account_num, 4, user[0].card_number, 14, user[0].balance); } else if (strcmp(yara, user[1].user_name) == 0) { printf("\n"); print_struct(user[1].user_name, user[1].bank_name, user[1].account_num, 4, user[1].card_number, 14, user[1].balance); } else if (strcmp(yara, user[2].user_name) == 0) { printf("\n"); print_struct(user[2].user_name, user[2].bank_name, user[2].account_num, 4, user[2].card_number, 14, user[2].balance); } else if (strcmp(yara, user[3].user_name) == 0) { printf("\n"); print_struct(user[3].user_name, user[3].bank_name, user[3].account_num, 4, user[3].card_number, 14, user[3].balance); } else if (strcmp(yara, "x") == 0) { goto label3; } else { printf("\aError. Enter a valid username. or press x to end program.\n"); goto labelinf; } } else { printf("\aError. Try again or press x to end program.\n"); goto labelinf1; } } else if (strcmp(xbank_staff, "x") == 0) { goto label3; } else { printf("\aError. Enter a valid name or press x to end program.\n"); goto labelinf1; } } else if (num == 2) { printf("For card-less services press 1:\t\t\tIf you have a card press 2:\n"); int c; label: scanf_s("%d", &c); if (c == 1) {//depositing money in a bank acounnt without card number , we will need the account number of the address you want to deposit money to int choicey = 0; label6: printf("If you need to make a withdrawal PRESS 1\t\t\tIf you need to make a DEPOSIT PRESS 2\n"); scanf_s("%d", &choicey); if (choicey == 1) A flowchart for that part of a code
char xusername[10];
char xbankname[10];
int xaccountnum[4];
int xcardnum[14];
int xpass[4];
int xwalletnum[11];
int xOTP[4];
printf("Enjoy a range of our banking services including cash withdrawals and deposits, card and loan installment payments, bill payments, smart wallet recharge, and card-less services.\n\n\n");
printf("If you are bank staff press 1. \t\t\t If you are a customer press 2.\n");
int num;
label0:
scanf_s("%d", &num);
if (num == 1) {//bank staff
char bank_staff[10] = { "mahmoud" };
char xbank_staff[10];
int bank_pass[4] = { 5,5,5,5 };
int xbank_pass[4];
int doha = 0;
labelinf1:
printf("Enter your name.\n");
scanf_s("%s", xbank_staff, 10);
if (strcmp(xbank_staff, bank_staff) == 0) {
printf("Enter your password.\n");
scan_array(xbank_pass, 4);
for (int i = 0; i < 4; i++) {
if (xbank_pass[i] == bank_pass[i]) {
doha++;
}
else {
printf("\aWrong password.\n");
break;
}
}
if (doha == 4) {
printf("Enter the name you want to show their data.\n");
char yara[10];
labelinf:
scanf_s("%s", yara, 10);
if (strcmp(yara, user[0].user_name) == 0) {
printf("\n");
print_struct(user[0].user_name, user[0].bank_name, user[0].account_num, 4, user[0].card_number, 14, user[0].balance);
}
else if (strcmp(yara, user[1].user_name) == 0) {
printf("\n");
print_struct(user[1].user_name, user[1].bank_name, user[1].account_num, 4, user[1].card_number, 14, user[1].balance);
}
else if (strcmp(yara, user[2].user_name) == 0) {
printf("\n");
print_struct(user[2].user_name, user[2].bank_name, user[2].account_num, 4, user[2].card_number, 14, user[2].balance);
}
else if (strcmp(yara, user[3].user_name) == 0) {
printf("\n");
print_struct(user[3].user_name, user[3].bank_name, user[3].account_num, 4, user[3].card_number, 14, user[3].balance);
}
else if (strcmp(yara, "x") == 0) {
goto label3;
}
else {
printf("\aError. Enter a valid username. or press x to end
goto labelinf;
}
}
else {
printf("\aError. Try again or press x to end program.\n");
goto labelinf1;
}
}
else if (strcmp(xbank_staff, "x") == 0) {
goto label3;
}
else {
printf("\aError. Enter a valid name or press x to end program.\n");
goto labelinf1;
}
}
else if (num == 2) {
printf("For card-less services press 1:\t\t\tIf you have a card press 2:\n");
int c;
label:
scanf_s("%d", &c);
if (c == 1) {//depositing money in a bank acounnt without card number , we will need the account number of the address you want to deposit money to
int choicey = 0;
label6:
printf("If you need to make a withdrawal PRESS 1\t\t\tIf you need to make a DEPOSIT PRESS 2\n");
scanf_s("%d", &choicey);
if (choicey == 1)
A flowchart for that part of a code
Step by step
Solved in 2 steps with 3 images