I basically got all the errors out of this software program i am doing for my own study, not for school. But i keep getting an error saying that in the main program before the cout it is missing a ;. This leads to believe i am missing a ; somewhere in the class because right before the cout statement is where i make the object. So somewhere there is a problem and i cannot find it. Please help me...

#ifndef WIDGETPLANT_H
#define WIDGETPLANT_H

class WidgetPlant
{
private:
	int widgets;
	static const int hoursPerDay = 16;
	static const int widgetsPerHour = 10;
	int totalDays;
	int totalHours;

public:
	WidgetPlant(int w)
	{
		widgets = w;
		totalDays = widgets / (hoursPerDay * widgetsPerHour);
		totalHours = (totalDays %totalDays)/ hoursPerDay;
	}

	double getDays()
	{
		return totalDays;
	}
	double getHours()
	{
		return totalHours;
	}

};
#endif
#include <iostream>
#include "WidgetPlant.h"
using namespace std;

int main()
{
	int number;

	cout << "Enter how many widgets you wish to produce: " << endl;
	cin >> number;

	WidgetPlant W(number);

	cout << "It will take " << W.getDays() << " days and " << W.getHours(); << " hours of time." << endl;

	return 0;

}
Comments
Congrats on using code tags on your first post.

The code

cout << "It will take " << W.getDays() << " days and " << W.getHours(); << " hours of time." << endl;

should only have one ';' after the endl. The one after W.getHours() does not belong.

This article has been dead for over six months. Start a new discussion instead.