[Error] expected unqualified-id before '{' token and recipe for target '1.o' failed

#include <stdio.h>

int main();
{

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
On which line is it?
Check that line really carefully.
line 4 and 28 this my first time programming
3
4
int main() ; //←What is this boing here
{

28
29
30
31
int amountDesposit; //←Find the difference
printf("How much money do you want to deposit: $");
scanf("%d, &amountdeposit");
if(amountDeposit > 0) { //←Find the difference 
i got program running now the problem is when i input the pincode is always invalid

You never read anything in pincode.
scanf ("%d, &tmpPin"); You are missing argument telling where to save value you just read.
what should do.
Read it. Look at how it is done here: http://en.cppreference.com/w/c/io/fscanf#Notes
#include <stdio.h>

int main()
{

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
Did you enabled warnings? There is another exactly same error in your code:
30|warning: format '%d' expects a matching 'int*' argument [-Wformat=]|
if(option == 1 ) //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;
}
35 17 [Error] 'amountdeposit' was not declared in this scope
Where do you declare it? You cannot use nonexistant variable.
thank you its ruining :)
Topic archived. No new replies allowed.