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

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 ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.