when i choice the option deposit then chequing i enter the amoint of 500 but i get a garbage value of total. but when i enter for saving it works. can someone help me
Code:
```#include<stdio.h>
#include<conio.h>
#include <stdlib.h>

//void saving();
int chooseAccountType(void);
//int checkingtotal(int a);
main()
{     int num;
int a=0,b=0;
char ct;
int ta;
int aaa,aa,bb;
int total,total1;
int to;
do
{

char a;
printf(" a) Deposit\n");
printf(" b) Withdraw\n");
printf(" d) Account Balance\n");
printf(" e) Exit\n");
printf("Please select one of the choices above (a -> e):");
scanf(" %c",&ct);

if(ct=='a'||ct=='A')
{
aaa= chooseAccountType();
printf("the number is%i",aaa);
if(aaa==1)
{
printf("\nAmmount to be deposit in chequiking=>");
scanf(" %i",&aa);
num=num+aa;
printf("total %i aa %i",num,aa);
}
else if(aaa==2)
{
printf("\nAmmount to be deposit in saving=>");
scanf(" %i",&bb);
total1=total1+bb;
printf("total1 %i bb %i",total1,bb);
}
}
else if(ct=='b'||ct=='B')
{

}
else if(ct=='c'||ct=='C')
{
}
else if(ct=='d'||ct=='D')
{
aaa= chooseAccountType();
printf("number two %i", aaa);
if(aaa==1)
{
printf("Account Balance for checking=>%i",total);
}
else if(aaa==2)
{
printf("Account Balance for saving=>%i",total1);
}
}
else
{
printf("invalid Selection");
}
}
while(ct!='e');

getch();
}

int chooseAccountType(void)
{
int aa,b;

printf("\n1)Chequing");
printf("\n2)Saving");
printf("\nWhich Account would you like to use=>");
scanf(" %i",&aa);
if(aa==1)
{
return(aa);
}
else if(aa==2)
{
return(aa);
}
}```

2. Code:
```  if(aaa==1)
{
printf("\nAmmount to be deposit in chequiking=>");
scanf(" %i",&aa);
num=num+aa;
printf("total %i aa %i",num,aa);```
You never put a value into total when you make you deposit into checking. You put the value into num. However when you print your checking balance you do this:
Code:
`printf("Account Balance for checking=>%i",total);`
Which like all your other variables aren't initialized. You need to initialize all your variables prior to using them. Additionally, you should make your variable names descriptive, not this letter crap you are using.

3. Originally Posted by AndrewHunter
Code:
`               printf("\nAmmount to be deposit in chequiking=>");`
Which like all your other variables aren't initialized. You need to initialize all your variables prior to using them. Additionally, you should make your variable names descriptive, not this letter crap you are using.
It might also help if he knew how to spell "chequing"

4. Originally Posted by CommonTater
It might also help if he knew how to spell "chequing"
LOL....that is what I call a bilingual fail.