guyz im having hard time of making a program that could run like a simple ATM machine using turbo c(using conditional statement and looping)... I can't think will coz the dealine of submission is on next week... could you gave an idea of that program.. pls??? i will just change some concepts to make it more better... im having hard time in conditonal i dont know how to use coz im just starting to learn turbo c.... but i found it quite fun.. hehe...

guyz im having hard time of making a program that could run like a simple ATM machine using turbo c(using conditional statement and looping)... I can't think will coz the dealine of submission is on next week... could you gave an idea of that program.. pls??? i will just change some concepts to make it more better... im having hard time in conditonal i dont know how to use coz im just starting to learn turbo c.... but i found it quite fun.. hehe...

You need to write down your ATM options on each scrren, before you can program anything meaningful.

Welcome - Please Enter Your ATM Card, and Your PIN.

Then:
Options:
1) Withdraw Cash 2) Deposit Cash 3) Check Balance

etc.

Post up all this as part of your menu() function, with each option being another small function. That would work well.

Show us some code, and some real work on this, or you won't get much help, imo.

I think that you should learn C keyword and conditional statement. Then you can think out the pseudocode then I pass to code. you show the menu on the screen as an interface,

for example:

Hello please enter the ID?
Kevin
welcome Kevin. Please enter your password?
******

---MENU---
[W]ithdraw Cash
[D]eposit Cash
[C]heck Balance
enter the choice?

İt might look like above , OK ?

Here is my Algo.. so that i could elaborate more:(this just a simple ATM machine that using looping and conditional).

1. Input your PIN#: 786805, If he inputed wrong, a message will appear "Sorry PIN# does not exist! Please try again.." If he inputed correctly then it will proceed to MENU.

2. Hello and Welcome!
----MENU----
alance Inquiry
[D]eposit Cash
[W]ithdraw Cash
[S]ign Out

3. If he choose alance Inquiry show to the user his current balance of P8,000.00
Press [C] to continue to MENU.

4. If he choose [D]eposit, let him input an amount he want to Deposit and ask the user "Do you want to proceed?". If [N]o then the balance will still remain in his current amount. If [Y]es add the amount he inputed/deposited to his current balance.
And a statement will appear "Your current balance is now P_______.
Press [C] to continue to MENU.

5. If he choose [W]ithdraw, then let him input an amount he want to withdraw if he inputed/withdrawn an amount less than or equal to his current balance, ask the user "Do you want to proceed?". If [N]o then the balance will still remain in his current amount. If [Y]es then deduct or subtract the amount he inputed/withdrawn to his current balance. But if he inputed/withdrawn an amount that is greater than in his current balance, a message will appear "Im sorry you have an insufficient balance! Please input an appropriate amount to withdraw.."
(second time)input an amount he want to withdraw if he inputed/withdrawn an amount less than or equal to his current balance, ask the user "Do you want to proceed?". If [N]o then the balance will still remain in his current amount. If [Y]es then deduct or subtract the amount he inputed/withdrawn to his current balance.
And a statement will appear "Your current balance is now P_______.
If he withdrawn all his current balance
a message will appear the next time he wants to withdraw "Sorry your current balance is P0.00! Can't proceed.."
Press [C] to continue to MENU.

6.If he choose [S]ign Out a message will appear "Thank you and have a nice day!!.."

(it is easy for me to make an algo and flowcharts and now i'm starting to study looping and conditionals but i dont know how to use them correctly.. so that im searching a site that i could see how to use them.. thats why im here and i hope that someone could show me how to use that program properly.. i know that i can't rely all my programs to somebody else thats why im finding ways to understand all this programs... im just a first year and i want to learn more...)

do u ve any condition to chk d validity of the pin number?
otherwise d functional part may be like this..

while(1)
{
printf("enter id");
scanf(%d,&id);
if(condition)
{
  menu();
printf("exit?")
scanf(%d,&ans);
if(yes)
exit(0);
}
}
else
{
print("enter correct id");
}
}

menu()
{

while (1)
{
switch(ch)// appropriate case//
{
case b:
.
.
.
.
case w :
printf//enter amount//
scanf()//amount//
if(amount< balance)
{
//error//
}
else
{
//deduct amount from balance and display//
}
} //end of switch//
printf//do u wanna continue?//
scanf//ans//
if(n)
return
}//end of while// loops continuosly by default//
} //end of func//

if you have any doubts .. ask me back..

huh??? i'm confuse.. where should i put the menu?? should i use char or int for the PIN#??

[guys i have code here but it isn't finish yet.. please give me some hints to finish this code]

#include<stdio.h>
#include<conio.h>


main()
{
int PIN;
PIN = 786805;
clrscr();
printf("\nEnter your PIN: ");
scanf("%d",& PIN);

try_again;
if(PIN!=786805)
     {
      printf("\nSorry! PIN doesn't exist... Please try again!");
      goto try_again;
      }
else if(PIN==786805)
      {
       printf("\nHello! Welcome...");
       }




[im confuse in this part if what should i use, should it be do while or switch?? i dont know if this correct.. please help..]


[guyz im asking if this will run if i'll connect it with this...]


menu() 

char b,d,w,s;
do
{

     print("\n--------MENU--------");
     printf("\n[B]alance Inquiry");
     printf("\n[D]eposit");
     printf("\n[W]ithdraw");
     printf("\n[S]ign Out");
     scanf("%c%c%c%c,"& b,d,w,s");
}

while()

Maybe read about code tags.
There's plenty of places where they get mentioned before you get to posting, try reading some of them.

In main() you call the menu() function. The menu() function has a very large do while loop in it that usually starts with ** Welcome to ...... **" kind of banner at the top.

Inside the menu(), you'll present the choices, ask the user to choose which one they want, and then you'll have a large switch statement that will guide the program to the right functions depending on the user's choice.

int main(void)  {
   menu();
   return 0;
}  
void menu()   {
   int i, choice, etc.

   do   {
      print "Welcome to My Program's Main Menu", whatever
      print "Please select from the following choices"

      1) Deposit
      2) Cash Withdrawal
       ...
      9) Cancel or Quit

      etc.  (Your menu choices looked better than mine :) )
      scanf("%d", &choice);  //fgets() is much better but I understand books 
                             //don't usually teach with it.
      switch(choice)   {      
         case 1: call your functions to handle Deposits; break;
         case 2: call your functions to handle Cash Withdrawal; break;
         etc.
         default: print I didn't understand that choice; break;
      } //end of switch
   }while(choice != 9);

}
This article has been dead for over six months. Start a new discussion instead.