Hello, I am a student attending a communintiy college in southern California. Im currently taking a course entitled, "Programming in C++.". The class book is entitled, " An Introduction to Programming C++", Sixth edition. I need, help with my homework. Our homework is to workout the exercises at the end of each chapter in the book, write them out in C++ code,plug them into the source files, then debug for errors. Please help me. By reviewing the source file I attached to this page. There are errors, on lines 19,20,23,24,26. Please help.

Heres the exercise. By the way we havent't atarted implementing loop statments yet.

13. Karlton Learning wants a program that displays the amount of money
a company owes for a seminar. Th e fee per person is based on the
number of people the company registers, as shown in Figure 6-43. For
example, if the company registers seven people, then the total amount
owed is $560. If the user enters a number that is less than or equal to
zero, the program should display an appropriate error message.
Number of registrants Fee per person
1 through 4 $100
5 through 10 $80
11 or more $60
Figure 6-43

Edited by Mosey Mo: n/a

// edited by <> on March 7, 2012>
#include <iostream>
using namespace std;
int main()

//declare variables
int people    =       0;
int fee       =	      0;
  cout << "Number of People: ";
  cin >> people;

if (people >= 1 || people <= 4);
	fee =  people *100;

else if (people >= 5 || people =< 10);
 	fee =  people * 80;
else if (people >= 11);
	fee = people * 60;
 (people  =< 0);
cout << " Error No Fee" << endl;
cout <<  " Fee: $ " << fee << endl;
	return 0;
}	//end of main function
4 Years
Discussion Span
Last Post by ravenous

You have 2 syntax problems and one logic problem. The syntax problems are:

  1. You don't need a semi-colon at the end of a line that contains a control structure, like an if statement. That is, this is incorrect:
    if ( someCondition );
       /* Do things */

    You want this instead:

    if ( someCondition )
       /* Do things */
  2. There is no such operator as =< , use <=

I'll leave it up to you to find the logic error, since that's your homework ;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.