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;

}
Salem commented: Congrats on using code tags on your first post. +27

Recommended Answers

All 3 Replies

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.

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.