From 0aa4b90f7a4c9a3d7a2b2ace586b851539a32124 Mon Sep 17 00:00:00 2001 From: fdai6618 <74294567+fdai6618@users.noreply.github.com> Date: Sat, 4 Feb 2023 11:39:17 +0100 Subject: [PATCH] implement methode getReceiverAccountNumber --- src/sendmoney.c | 30 ++++++++++++++++++++++++++++++ src/sendmoney.h | 1 + 2 files changed, 31 insertions(+) diff --git a/src/sendmoney.c b/src/sendmoney.c index 6e798c4..2f27bd4 100644 --- a/src/sendmoney.c +++ b/src/sendmoney.c @@ -19,3 +19,33 @@ float getAmount(float amountToSend) return amountToSend; } +// hier die wird die Kontonummer eingegeben und getestet +void getReceiverAccountNumber() +{ + + int accountNumber; + + printf("Enter The account in Which you want to transfer the money:"); + scanf("%d", &accountNumber); + int counter = 0; + while (checkAccount(accountNumber) == false && counter <= 2) + { + + printf("Bitte geben Sie einen Gueltigen Kontonummer:\n"); + scanf("%d", &accountNumber); + counter++; + } + + if (checkAccount(accountNumber) == false) + { + printf("Konto ist ungultig\n"); + + printf("Programm wird beendet"); + exit(0); + } + + else + { + printf("KontoNummer Gültig"); + } +} diff --git a/src/sendmoney.h b/src/sendmoney.h index 4bc6bb4..c54012f 100644 --- a/src/sendmoney.h +++ b/src/sendmoney.h @@ -8,4 +8,5 @@ bool checkAccount(int accountNumber); double getAvailableAccountBalance(double balance); float getAmount(float amountToSend); +void getReceiverAccountNumber(); #endif // SENDMONEY_H