I know I am missing a big part of this program but for some reason my mind is not working at all tonight.

I need to:

Write a program that asks the user to enter the duration of a baseball game
by first asking for the number of hours and then asking for the number of minutes. The program should display the total number of minutes that the game lasted.

//prb01-1.cpp
//This program calculates the total number of minutes in a baseball game



#include <iostream.h>
#include <iomanip.h>


//using namespace std:


int main()
{
const int innings per baseball game;
int hours,     //#of hours
minutes,   //# of minutes


//obtain the input data
cout<<"\nEnter the number of hours of the game:";
cin>> hours;
cout<<"\nEnter the number of minutes:";
cin>> minutes;


//Do the calculations
hours = hours;
minutes = hours / 60;


//Display the results
cout<<"\n hours"
cout<<"\n"


return 0;
}

Just a handful of errors.

First it probably was not compiling because of this area

int hours,     //#of hours
minutes,   //# of minutes

should be

int hours, minutes;

Also this area has logic problems..

//Do the calculations
hours = hours;
minutes = hours / 60;


//Display the results
cout<<"\n hours"
cout<<"\n"

..make it look like this...

//Do the calculations
minutes += hours * 60;


//Display the results
cout<< minutes << endl;

That will work fine.

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.