I have made my class interface and saved it as "Factorial.h". I have then written the class implementation and saved it as a .cpp file. In the .cpp file I am trying to include my header file but I am getting the message "no such file or directory. I believe it is because I am not telling the IDE where the file is but I am unsure how to do that.
Am I doing it correctly and how do I tell the IDE where to find the .h file?
//This is my header file which is saved as Factorial.h
//Title: Class Factorial
//Description: Class that calculates fatcorial using the number inputted by user
#include <iostream>//not sure if this is needed?
usingnamespace std;//not sure if this is needed?
public://begin public section
unsignedint get_number();//accessor member function
void set_number();//accessor member function
unsignedint get_value ();
void set_value ();
private://begin private section
unsignedint its_number;//member variable
unsignedint its_value;//member variable
//This is my program which includes the class implementation
//Public accessor function which returns value of its_number member
return its_number;//returns value of member variable its_number
//Public accessor function which sets value of its_number member
cout << "Enter your number: ";//user prompted to enter number
cin >> number;
its_number = number;//setting value of member variable its_number
//Public accessor function which returns value of its_value member
//Public accessor function which is used to set value for "its_value"
void Factorial::set_value ()
if (its_number == 1 || its_number == 0)
its_value = 1;
unsignedint value = its_number;//declaring variable value that holds the value of the calculated factorial.
unsignedint count = its_number;//count used to replace its_number as we don't want to change the value
for (count; count > 1; count--)
value *= (count-1);//calculating factorial
its_value = value;//setting value for its_value
int main ()
Factorial myFactorial;//creating object of class Factorial
myFactorial.set_number();//calling member function to set value of member variable its_number
myFactorial.set_value ();//calling member function to set value of member variable its_value
cout << myFactorial.get_number() << "! is " << myFactorial.get_value() << endl;
_getch ();//pauses program