Need Assistance fixing this program

Design a class called Heading that has data members to hold the company name and
the report name. A two-parameter default constructor should allow these to be
specified at the time a new Heading object is created. If the user creates a
Heading object without passing any arguments, “ABC Industries” should be used as a
default value for the company name and “Report” should be used as a default for
the report name. The class should have member functions to print a heading in
either one-line format, as shown here:

Pet Pals Payroll Report
or in four-line “boxed” format, as shown here:
*********************************************
Pet Pals
Payroll Report
*********************************************

Try to figure out a way to center the headings on the screen, based on their lengths.
Demonstrate the class by writing a simple program that uses it.


-----------------
When I run the program it saying that heading.h file is not found. How would I be able to fix this. Here is what I got so far;

#include <iostream>
#include "Heading.h"
using namespace std;

void inputHeading(Heading&);
void printHeading(Heading &);

int main()
{
Heading Test;

inputHeading(Test);

printHeading(Test);

return 0;
}

void inputHeading(Heading &H)
{
string C, R;

cout << "\n Report header setup\n"
<< "--------------------------------------\n";
cout << "Enter company name: ";
getline(cin, C);
cout << "Enter report name: ";
getline(cin, R);

H.setHeading(C, R);
}

void printHeading(Heading &H)
{
int Num;

cout << "\n Report header print menu\n"
<< "-------------------------------------------\n";
cout << " Choose your report header fromat:\n"
<< " 1. Print a one-line header.\n"
<< " 2. Print a four-line header.\n";
cin >> Num;

switch(Num)
{
case 1 : H.prtOneline(H);
break;
case 2 : H.prtFourline(H);
}

}
Hello MA2121,

While I try to read your program.


PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code.

Along with the proper indenting it makes it easier to read your code and also easier to respond to your post.

http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/

Hint: You can edit your post, highlight your code and press the <> formatting button. This will not automatically indent your code. That part is up to you.

You can use the preview button at the bottom to see how it looks.

I found the second link to be the most help.


I see the line: #include "Heading.h" . Post the file so people do not have to guess at what might be there.

It sounds like when the program runs it is looking for the file in the current working directory, but you may have put the file somewhere else.

It also helps if you mention what IDE you are using.

Andy
Topic archived. No new replies allowed.