RE: Here is my modified program, thoughts? corrections?

  • From: "Homme, James" <james.homme@xxxxxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 15 Jul 2010 11:59:37 -0400

Hi,
I can't figure this out. Maybe you need to have && in the statement that talks 
about > 4 & < 9. But what's going on if it is either 4 or 9?

Jim

Jim Homme,
Usability Services,
Phone: 412-544-1810. Skype: jim.homme
Internal recipients,  Read my accessibility 
blog<http://mysites.highmark.com/personal/lidikki/Blog/default.aspx>. Discuss 
accessibility 
here<http://collaborate.highmark.com/COP/technical/accessibility/default.aspx>. 
Accessibility Wiki: Breaking news and accessibility 
advice<http://collaborate.highmark.com/COP/technical/accessibility/Accessibility%20Wiki/Forms/AllPages.aspx>

From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jes
Sent: Thursday, July 15, 2010 11:32 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Here is my modified program, thoughts? corrections?

***program:
//Ch7AppE04.cpp
 //Displays total price of registrations.
//Created/revised by <Jes Smith on July 15, 2010.

#include <iostream>
#include <iomanip>

using std::cout;
using std::cin;
using std::endl;
//using std::fixed;
//using std::setprecision;
//declare variables
float totalPrice = 0;
float averagePayment = 0;
int regNumber = 0;
//regNumber, The number of registrants stored in this variable.
//totalPrice The total cost for the company.
//averagePayment The payment the registrant makes to the company for attending 
the seminar.

int main()
{
cout << "Enter number of people who will be registered. \n Press enter after 
each number.\n Enter a negative number to get the total price: " << endl;
cin >> regNumber;
 while (regNumber >= 0)
{
cout << "Enter your next entry. Enter negative number to get total price: " 
<<endl;
cin >> regNumber;
} //endwhile
if (regNumber > 1 && regNumber < 3)
totalPrice = 150;
else if (regNumber > 4 < 9);
totalPrice = 100;
 if (regNumber >= 10)
 {
                totalPrice = 90;}

totalPrice = (regNumber + totalPrice);
cout << regNumber << endl;
cout << totalPrice << endl;

return 0;
} //end of main function

________________________________
This e-mail and any attachments to it are confidential and are intended solely 
for use of the individual or entity to whom they are addressed. If you have 
received this e-mail in error, please notify the sender immediately and then 
delete it. If you are not the intended recipient, you must not keep, use, 
disclose, copy or distribute this e-mail without the author's prior permission. 
The views expressed in this e-mail message do not necessarily represent the 
views of Highmark Inc., its subsidiaries, or affiliates.

Other related posts: