 |
gregorygarver.com San Francisco Real Estate Forum
|
| Author |
Message |
ajhe_82
Joined: 26 Jan 2004 Posts: 3
|
Posted: Thu Jul 15, 2004 12:43 am Post subject: C++ program need help? |
|
|
| /******************************************************************************* fuwen xu 05/11/07 switch and looping.cpp ** This program compute the commissions for the real estate company ** Input:choice,agent_id,rsp,csp,msp,yesno, ** Output:nr,nc,nm,mc,trc,tcc, *************************************** HISTORY ***************************** WhoDate Description ********************************************************************************* Fuwen Xu 05/11/2007 calculate commissions *******************************************************************************/#include #include using namespace std;#define RCR 0.1/*residential commission rate*/#define CCR 0.2/*commercial commission rate*/#define MCR 0.15/*multiunt dwelling commission rate*/int main(){int id,/*five digit number ID*/price,/*selling pricce*/nr=0,/*number of residential commissions computed*/nc=0,/*number of commerical commissions computed*/nm=0,/*number of multiunit commissions computed*/yesno;/* program loops when = 1*/double trc=0.0 ,/*total of residential commissions*/ tcc=0.0 ,/*total of commerical commissions*/ tmc=0.0 ; /*total of multiunit dwelling commissions*/char choice,/*choose the what category r, c, m*/space = ''; /*space*/cout <<"\n\n\n\n";cout <<"\n***************Fuwen Commission Computer******************\n";cout <<"\nDo you have a commission to compute?(1 = yes, 0 = no)? ";cin >> yesno;while (yesno == 1){cout <<"\nPlease enter the Agent ID: ";cin >> id;cout <<"\nPlease enter the category of property sold";cout <<"\n(R = residential, C = commercial, M = multiunit): ";cin >> choice;switch(choice){case 'r':case 'R':trc-=trc;cout <<"Please enter the selling price: ";cin >> price;trc += (price*RCR);nr += 1;cout <<"\n\nThe commission for this sale for Agent "<> price;tcc += (price*CCR);nc+=1;cout <<"\n\nThe commission for this sale for Agent "<> price;tmc += (price*MCR);nm+=1;cout <<"\n\nThe commission for this sale for Agent "<> yesno;}trc+=trc;tcc+=tcc;tmc+=tmc;cout <<"\n\n********************End of Run Report************************";cout <<"\n\nTotal number of Residential commissions computed = "< |
|
| Back to top |
|
 |
JJ
Joined: 10 Dec 2006 Posts: 4
|
Posted: Fri Jul 23, 2004 1:34 pm Post subject: C++ program need help? |
|
|
| Err, whats your question? |
|
| Back to top |
|
 |
godged5497
Joined: 14 Mar 2006 Posts: 10
|
Posted: Sun Aug 01, 2004 2:24 am Post subject: C++ program need help? |
|
|
| Well, what's the problem?(You're better off telling us the problem is than just posting the code. When we see the code, Y!Answers will truncate long lines so we can't just cut and paste it into our compilers.) |
|
| Back to top |
|
 |
MichiganT
Joined: 21 Sep 2004 Posts: 4
|
Posted: Mon Aug 09, 2004 3:15 pm Post subject: C++ program need help? |
|
|
| BigRez,who says u to "cut" and "paste".if u know the answer thenjust "select" and"copy" then "paste" to C++.Sorry i can't anser to question b/c i am C student not C++. |
|
| Back to top |
|
 |
PatriciaC
Joined: 21 Dec 2003 Posts: 8
|
Posted: Wed Aug 18, 2004 4:05 am Post subject: C++ program need help? |
|
|
| Your code doesn't keep an accurate total count of sales. For example, for switch case r/R you have trc-=trc, basically setting trc = 0 EVERY TIME switch case r/R is run. So the count is essentially wiped out all the time and when you're done the count isn't correct. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
| Gregory Garver