int balance =0,pin =1234,tmpPin;
int anothertransaction = 1; //do another transaction, 2 no, not another action
printf ( "Please enter your pin:");
scanf ("%d, &tmpPin");
if (pin !=tmpPin)
{
printf("Invalid Pin.\n");
return 0;
}
while (anothertransaction == 1)
{
int option;
printf("what do you want to do?: \n");
printf("1 - check your balance\n");
printf("2 - Deposit\n");
printf("3 - Withdraw\n");
scanf ("%d",&option);
if(option == 2 ) //check balance
{
printf("your balance is %d", balance);
}
else if (option == 2) // deposit
{
int amountDesposit;
printf("How much money do you want to deposit: $");
scanf("%d, &amountdeposit");
if(amountDeposit > 0)
{
balance += amountDeposit;
}
else
{
printf("Invalid depositamount\n");
}
}
else if(option == 3) //withdraw
{
int amountwithdraw;
printf("How much money do you want to withdraw: $");
scanf("%d", &amountwithdraw);
if(amountwithdraw <= balance && amountwithdraw % 20 == 0)
{
balance -= amountwithdraw;
}
else
{
if(amountwithdraw > balance )
{
printf("you dont have enouph money. Declined.\n");
}
else
{
printf("you must enter an amout that is divisible by 20\n");
}
}
}
else
{
printf("Invalid Transaction.\n");
}
anothertransaction = 0;
while(anothertransaction != 1 && anothertransaction != 2)
{
printf("do you want to do another transaction: \n");
printf("1 - yes, 2 - no\n");
scanf("%d", &anothertransaction);
}
}
return 0;
}
can somebody help me with this
[Error] expected unqualified-id before '{' token
recipe for target '1.o' failed
intamountDesposit; //←Find the difference
printf("How much money do you want to deposit: $");
scanf("%d, &amountdeposit");
if(amountDeposit > 0) { //←Find the difference
int balance=0,pin =1234,tmpPin;
int anothertransaction = 1; //do another transaction, 2 no, not another action
printf ( "Please enter your pin:");
scanf ("%d", &tmpPin);
if (pin !=tmpPin)
{
printf("Invalid Pin.\n");
return 0;
}
while (anothertransaction == 1)
{
int option;
printf("what do you want to do?: \n");
printf("1 - check your balance\n");
printf("2 - Deposit\n");
printf("3 - Withdraw\n");
scanf ("%d",&option);
if(option == 2 ) //check balance
{
printf("your balance is %d", balance);
}
else if (option == 2) // deposit
{
int amountDeposit;
printf("How much money do you want to deposit: $");
scanf("%d, &amountdeposit");
if(amountDeposit > 0)
{
balance += amountDeposit;
}
else
{
printf("Invalid depositamount\n");
}
}
else if(option == 3) //withdraw
{
int amountwithdraw;
printf("How much money do you want to withdraw: $");
scanf("%d", &amountwithdraw);
if(amountwithdraw <= balance && amountwithdraw % 10 == 0)
{
balance -= amountwithdraw;
}
else
{
if(amountwithdraw > balance )
{
printf("you dont have enouph money. Declined.\n");
}
else
{
printf("you must enter an amout that is divisible by 10\n");
}
}
}
else
{
printf("Invalid Transaction.\n");
}
anothertransaction = 0;
while(anothertransaction != 1 && anothertransaction != 2)
{
printf("do you want to do another transaction: \n");
printf("1 - yes, 2 - no\n");
scanf("%d", &anothertransaction);
}
}
return 0;
}
my problem is when i try to deposit we just looping to "to do another transaction and i cant deposit an amount