Selamlar. Codeblocks'tan projem için bir ATM projesi yazıyorum. (YouTube'dan bakarak.) Kodu bitirdim yalnız hata alıyorum. Nedenini bir türlü bulamadım. Başka birinin açtığı konuda dosya yolunu C:'ye kaydetmek vardı. Denedim ama o da işe yaramadı.
Dosya yoluyla alakasi yok. Hatali cikis yapmis programin. Ya sigseg almissin yada abort almissin. Kodlari paylas ki tahmin etmekle ugrasmayayim.
#include <stdio.h>
#include <stdlib.h>
double RecentBalance;
void ShowBalance(double balance){
printf("Your Recent Balance : %f TL\n, balance");
}
int WithdrawMoney(double balance, int money){
if(money < balance){
RecentBalance = balance -money;
return RecentBalance;
}
printf("Insufficient Balance!\n");
return balance;
}
int DepositMoney(double balance, int DM) {
double RecentBalance = balance + DM;
return RecentBalance;
}
int main()
{
const int sysUserID = 867443;
int sysCardPassword = 4056;
double balance = 20000;
int Right = 3;
int UserID, CardPassword;
while (1) {
printf("User ID ");
scanf("%d", UserID);
printf("Card Password : ");
scanf("%d", &CardPassword);
if(sysUserID != UserID || sysCardPassword != CardPassword){
printf ("Incorret UserID or Password!\a\n");
Right = Right-1;
}
else {
while (1) {
int transaction, WM,DM;
printf("Menu : \n1-)Balance Inquiry\n2-)Withdraw Money\n3-)Deposit\n4-)Card Return and Exit\n");
printf("Choose the transaction you want to do : ");
scanf("%d", &transaction);
if (transaction == 4)
{
printf("Your card is being returned.\n");
}
switch (transaction) {
case 1 :
ShowBalance(balance);
break;
case 2:
printf("The amount you want to withdraw : ");
scanf("%d", &WM);
WithdrawMoney(balance, WM);
break;
case 3:
printf("The amount you want to deposit.");
scanf("%d", &DM);
balance = DepositMoney(balance, DM);
break;
default:
printf("You typed wrong!\a");
}
}
}
if (!Right){
printf("Your card has been blocked. Go to our nearest branch and get a new card.\n");
} }
return 0;
}
scanf("%d", &UserID);
Teşekkürler. Chat GPT ile düzelttim. Birkaç yerde daha hata varmış.UserID aldigin yerde ampersand yok. O satiri soyle degistir;
C:scanf("%d", &UserID);
Baska bir problem gorursem soylerim.
void ShowBalance(double balance){
printf("Your Recent Balance : %f TL\n", balance);
}
Bu sitenin çalışmasını sağlamak için gerekli çerezleri ve deneyiminizi iyileştirmek için isteğe bağlı çerezleri kullanıyoruz.