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...


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

	WidgetPlant(int w)
		widgets = w;
		totalDays = widgets / (hoursPerDay * widgetsPerHour);
		totalHours = (totalDays %totalDays)/ hoursPerDay;

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

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

Votes + Comments
Congrats on using code tags on your first post.
9 Years
Discussion Span
Last Post by rosenberg_a

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 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.