| | |
a department-store customer progam
![]() |
•
•
Join Date: May 2007
Posts: 30
Reputation:
Solved Threads: 0
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
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
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Apr 2007
Posts: 103
Reputation:
Solved Threads: 17
to get you started
C++ Syntax (Toggle Plain Text)
struct Customer {<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>} Show() {<blockquote>cout << accountNumber << '\n' << balance << '\n' << credits << '\n' << charges << '\n';</blockquote>} </blockquote>}; int main() { <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.
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.
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.
*Voted best profile in the world*
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- frustrated newbie needs help (C++)
- Very easy problem- i can't seem to get (VB.NET)
- Need help with a vb.net project (VB.NET)
- C++ help (C++)
Other Threads in the C++ Forum
- Previous Thread: How To Uswe A For Loop
- Next Thread: Justification
| Thread Tools | Search this Thread |
action api array auto based beginner binary bitmap c++ c/c++ calculator challenge char class classes code coding compile console conversion count createcopyofanyfileinc delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game garbage givemetehcodez graph gui hmenu homeworkhelp homeworkhelper iamthwee ifstream input insert int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node noob output parameter pointer primenumbersinrange problem program programming project python random read recursion reference rpg sockets string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






