Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C and C++

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-30-2008, 12:43 PM
helpplease helpplease is offline
Newbie
 
Join Date: Mar 2008
Posts: 2
Credits: 0
Rep Power: 0
helpplease is on a distinguished road
Default Help Me!

I'm suppose to create a program for a commercial bank.
The program should start with the following menu:
Press 1. To add new customer
2. To carry out a transaction
3. To exit
If the user selects 1 the program should ask for name, address, telephone number and the amount depositing.
If the user selects 2 he is given another menu.
Press 1. For Withdrawal
2.For Deposit
3. For Enquiry
If the user selects 1 which is withdrawal, he/she should ask the user for their customer no. and the amount to withdraw.
If the user select 2 which is deposit ask the user for customer
number and the amount to deposit.
If the user selects 3 ask for the customer number and print the customers balance.
After each transaction print the users balance.

This is what i have so far:

c Code:
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4.  
  5. int gun;
  6. int cat;
  7. int potion;
  8. int hate;
  9. int dagger;
  10. int wow;
  11. int token;
  12. char name[100];
  13. char address[100];
  14. int tagger;
  15. int myarray[7];
  16.  
  17. void menu_option() {
  18. printf("\n Welcome to Saleem's Commercial Bank");
  19.             printf("\n Press 1 if you are a new customer\n Press 2 if you want to carry out a transaction\n");
  20.             printf("\n Press 3 to exit the system");
  21.             printf("n\n Your choice->");
  22.             scanf("%d",&dagger);
  23. }
  24.  
  25.            void option_two(){
  26.                 switch(wow)
  27.                      {
  28.                       case 1: printf("\n Please enter your customer number");
  29.                       scanf("%d",&potion);
  30.                        printf("\n Please enter the amount you are withdrawing");
  31.                       scanf("%d",&cat);
  32.                             break;
  33.                              
  34.                 case 2: printf("\n Please enter your customer number");
  35.                               scanf("%d",&gun);
  36.                               printf("\n Please enter the amount your depositing");
  37.                               scanf("%d",&hate);
  38.                               break;
  39.                  
  40.                 default:("\n Please try again");
  41.                     }
  42.             }
  43.            
  44.    int main()
  45.    {
  46.        menu_option();
  47.         struct customer_information
  48.    {
  49.        char name[100];
  50.        char address[200];
  51.        int token;
  52.       
  53.    };
  54.     switch(dagger)
  55.     {
  56.        struct customer_information  person1;
  57.        {
  58.     case 1: printf("Please enter your name\n");
  59.             scanf("%s",name);
  60.  
  61.             printf("Please enter your address\n");
  62.             scanf("%s",&address);
  63.  
  64.             printf("Please enter your telephone number\n");
  65.             scanf("%d",&token);
  66.            
  67.             printf("Please enter the amount your depositing\n");
  68.             scanf("%d",&tagger);
  69.             
  70.             break;
  71.        };
  72.  
  73.        case 2printf("\n Please select the suitable option");
  74.                 printf("\n Press 1 for withdrawal\n Press 2 for deposit\n");
  75.                 printf("\n Press 3 enquiry");
  76.                 printf("n\n Your choice->");
  77.                 scanf("%d",&wow);
  78.                        break;
  79.    
  80.        case 3:printf("\n Thank You for using Saleem's Commercial Bank");
  81.                             break;
  82.    
  83.        default: printf("\n The number you pressed is invalid. Please try again");
  84.             menu_option();
  85.    
  86.     }
  87.                    option_two();
  88.  
  89.     return 0;
  90.    }

I am having problems with assigning customer numbers and also
in printing the balances.

Last edited by Jaan; 04-01-2008 at 12:11 AM. Reason: Use tags when you're posting your codes!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 04-01-2008, 11:54 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 2,453
Last Blog:
wxWidgets is NOT code ...
Credits: 761
Rep Power: 28
WingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the roughWingedPanther is a jewel in the rough
Default Re: Help Me!

It looks like you are having additional problems as well.

As far as assigning customer numbers, you will need a variable to store them in (your variable names don't make it clear if this has been done or not), then create a number that isn't being used (a variable can store the largest customer number).

To print the balances, you need to create some code for that, first.

Other observations: you can only perform one menu option before exiting. You don't have support for multiple customers. You are using a LOT of global variables. Have you created a flowchart or anything to sketch out the behavior of this program?
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 11:02 PM.

Contest Stats

Xav ........ 1276.19
MeTh0Dz|Reb0rn ........ 1048.58
marwex89 ........ 869.98
morefood2001 ........ 868.04
John ........ 865.15
WingedPanther ........ 761.06
Brandon W ........ 684.87
chili5 ........ 294.12
Steve.L ........ 216.18
dargueta ........ 192.86

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 81%

Ads