hello everyone.

i'm developing a program from a department-store customerhas exceeded the credit limit on a charge account.for each of the following facts are available.account no,balance of the begining of the month,i total of all items charged by this customer,total of all credit applied to this customer.'m required to instal all the items using while loop.

so what i did is,

int enterInfo=0;
while(enterInfo<5) (x++);
do{
int account,startBalance,endBalance.allowed,credits,charges;

cout<<"enter account number";
cin>>account;

cout<<"enter credits applied to account";
cin>>credits;

cout<<"enter credit card charges";
cin>>charges;

cout<<"enter starting balance";
cin>>startbalance;

cout >>"credit limit?";
cin>>allowed;

so i don't know how to proceed and ene the program please someone help

Recommended Answers

All 5 Replies

you probably want to create a structure to hold the data for each customer so that the values will not disappear on each iteration of the do-loop. Then you will need an array or a linked list of those structures. After entering the account number search the array or list for the structure that contains that account number. If found then adjust the members of the structure with the values you enter in the do-loop. If the structure is not in the list, fill out a new structure and add it to the array or list.

so how must i go about doing that i mean the pseudocode of th program

to get you started

struct Customer

{[INDENT]int accountNumber;[/INDENT]

[INDENT]double balance;[/INDENT]

[INDENT]int credits;[/INDENT]

[INDENT]int charges;[/INDENT]
 

[INDENT]Customer(int _accountNumber, double _balance, int _credits, int _charges)[/INDENT]

[INDENT]{[INDENT]accountNumber = _accoutnNumber;[/INDENT]

[INDENT]balance = _balance;[/INDENT]

[INDENT]credits = _credits;[/INDENT]

[INDENT]charges = _charges;[/INDENT]
}
 
Show()

{[INDENT]cout << accountNumber << '\n' << balance << '\n' << credits << '\n' << charges << '\n';[/INDENT]
}

[/INDENT]};
 
 
int main()
{

[INDENT]Customer customer1 = new Customer(003593, 45000, 3, 15);[/INDENT]

[INDENT]customer1.Show()[/INDENT]
 

[INDENT]return 0;[/INDENT]
}
Member Avatar for iamthwee

There are many options available to you. Personally, I would suggest using classes over structs in c++, as you can also define private member functions.

If you are using an array of objects don't forget to clear up after with delete[]. You could also use a vector of objects.

But the most important thing is, if you had to ask what they are, you probably need to read up on them before even attempting to integrate their usage in your current program.

There are many options available to you. Personally, I would suggest using classes over structs in c++, as you can also define private member functions. .

In c++ structures are nearly identical to classes, but yes a formal class would be preferable. structures can have private members too, just like classes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.