943,789 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3002
  • C++ RSS
May 11th, 2007
0

a department-store customer progam

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
nkhosinathie is offline Offline
30 posts
since May 2007
May 11th, 2007
0

Re: a department-store customer progam

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
May 13th, 2007
0

Re: a department-store customer progam

so how must i go about doing that i mean the pseudocode of th program
Reputation Points: 10
Solved Threads: 0
Light Poster
nkhosinathie is offline Offline
30 posts
since May 2007
May 13th, 2007
0

Re: a department-store customer progam

to get you started

C++ Syntax (Toggle Plain Text)
  1. struct Customer
  2.  
  3. {<blockquote>int accountNumber;</blockquote><blockquote>double balance;</blockquote><blockquote>int credits;</blockquote><blockquote>int charges;</blockquote><blockquote>Customer(int _accountNumber, double _balance, int _credits, int _charges)</blockquote><blockquote>{<blockquote>accountNumber = _accoutnNumber;</blockquote><blockquote>balance = _balance;</blockquote><blockquote>credits = _credits;</blockquote><blockquote>charges = _charges;</blockquote>}
  4.  
  5. Show()
  6.  
  7. {<blockquote>cout << accountNumber << '\n' << balance << '\n' << credits << '\n' << charges << '\n';</blockquote>}
  8.  
  9. </blockquote>};
  10.  
  11.  
  12. int main()
  13. {
  14. <blockquote>Customer customer1 = new Customer(003593, 45000, 3, 15);</blockquote><blockquote>customer1.Show()</blockquote><blockquote>return 0;</blockquote>}
Last edited by mariocatch; May 13th, 2007 at 3:02 pm.
Reputation Points: 11
Solved Threads: 17
Junior Poster
mariocatch is offline Offline
103 posts
since Apr 2007
May 13th, 2007
0

Re: a department-store customer progam

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.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
May 13th, 2007
0

Re: a department-store customer progam

Click to Expand / Collapse  Quote originally posted by 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. .
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.
Last edited by Ancient Dragon; May 13th, 2007 at 7:30 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How To Uswe A For Loop
Next Thread in C++ Forum Timeline: Justification





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC