![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 1
Rep Power: 0
![]() |
ATM Program Assignment problems
i have a programming assingment where i must create an ATM program. the basics of the program were that i had to get customer information from an input file, authenticate the account number and pin number, and create functions for withdrawals, deposits, and showing the balance. my program had all of these working, but now i have run into a problem. instead of getting the information for one customer from the file i have to get it for two customers. the file is a txt that looks like this:
account number pin number Customer Name Account Balance i have tried with arrays to get it to work, but cannot get it. im new at programming so any help will be greatly appreciated, thanx. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
Look into structs.
Like... struct customer {
char *name;
int acct, pin, balance;
}
customer initAcct(char *name, int acct, int pin, int balance);
int main(int argc, char*argv[]) {
// I am tempest,
// My account number is 1
// my pin is 1234
// and my balance is way too much money (i wish)
customer tempest = initAcct("Tempest", 1, 1234, 10000000000);
return 0;
}
customer initAcct(char *name, int acct, int pin, int balance) {
customer tmp;
strcpy(tmp.name, name);
tmp.acct = acct;
tmp.pin = pin;
tmp.balance = balance;
return tmp;
}
__________________
Last edited by tempest; Mar 14th, 2005 at 6:42 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|