split time reference point

hello. I am working on a project that displays a weight calculator using reference points:

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//prototypes
void inputNumber(string, int&);
void calculateCalories(double, int, int, double&);
void splitTime(int&, int&);
void displayHeader(string);
void displayLine(string, int, int, double);

int main() {
cout << "Welcome to Marie's Workout Calculator!" << endl;
string name;
cout << "Please enter your name: ";
getline(cin, name);
cout << endl;
int weight, badminMin, runMin, walkMin, liftMin;
inputNumber("Please enter your weight: ", weight);
cout << endl;
inputNumber("Please enter the minutes spent playing badminton: ", badminMin);
cout << endl;
inputNumber("Please enter the minutes spent running: ", runMin);
cout << endl;
inputNumber("Please enter the minutes spent walking: ", walkMin);
cout << endl;
inputNumber("Please enter the minutes spent lifting weights: ", liftMin);
cout << endl;
double badCalBurn, runCalBurn, walkCalBurn, liftCalBurn;
calculateCalories(0.044, weight, badminMin, badCalBurn);
calculateCalories(0.087, weight, runMin, runCalBurn);
calculateCalories(0.036, weight, walkMin, walkCalBurn);
calculateCalories(0.042, weight, liftMin, liftCalBurn);
displayHeader(name);
string bad = "Badminton";
string run = "Running";
string walk = "Walking";
string lift = "Lifting Weights";
string total = "Total";
int hours, totalMin, minutes, badMinHours, badMinMinutes, runMinHours, runMinMinutes;
int walkMinHours, walkMinMinutes, liftMinHours, liftMinMinutes;
double totalCal;
totalMin = badminMin + runMin + walkMin + liftMin;
totalCal = badCalBurn + runCalBurn + walkCalBurn + liftCalBurn;
splitTime(badMinHours, badMinMinutes);
splitTime(runMinHours, runMinMinutes);
splitTime(walkMinHours, walkMinMinutes);
splitTime(liftMinHours, liftMinMinutes);
splitTime(hours, minutes);

displayLine(bad, badMinHours, badMinMinutes, badCalBurn);
displayLine(run, runMinHours, runMinMinutes, runCalBurn);
displayLine(walk, walkMinHours, walkMinMinutes, walkCalBurn);
displayLine(lift, liftMinHours, liftMinMinutes, liftCalBurn);
displayLine(total, hours, minutes, totalCal);


return 0;
}

void inputNumber(string prompt, int& value) {
cout << prompt;
cin >> value;

}

void calculateCalories(double rate, int weight, int minutes, double& calculate) {
calculate= rate * weight * minutes;
}

void splitTime(int& hours, int& minutes) {
hours = minutes / 60;
minutes = minutes % 60;
}
void displayHeader(string personName) {
cout << "Here are the results for: " << personName << endl;
cout << left << setw(20) << "Activity" << setw(10) << "Time" << setw(5) << "Calories" << endl;
cout << "---------------------------------------------" << endl;

}
void displayLine(string activity, int hours, int minutes, double calories) {

cout << left << setw(20) << activity << setfill(' ') << hours << ":" << setw(2) << right << setfill('0') << minutes << setfill(' ') <<
setw(13) << setprecision(3) << fixed << calories << endl;
}

I had the understanding of using reference points, the only thing that is not displaying properly is the time. Please assist
Code tags...learn them, use them.
http://www.cplusplus.com/articles/jEywvCM9/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//prototypes
void inputNumber(string, int&);
void calculateCalories(double, int, int, double&);
void splitTime(int&, int&);
void displayHeader(string);
void displayLine(string, int, int, double);

int main() {
cout << "Welcome to Marie's Workout Calculator!" << endl;
string name;
cout << "Please enter your name: ";
getline(cin, name);
cout << endl;
int weight, badminMin, runMin, walkMin, liftMin;
inputNumber("Please enter your weight: ", weight);
cout << endl;
inputNumber("Please enter the minutes spent playing badminton: ", badminMin);
cout << endl;
inputNumber("Please enter the minutes spent running: ", runMin);
cout << endl;
inputNumber("Please enter the minutes spent walking: ", walkMin);
cout << endl;
inputNumber("Please enter the minutes spent lifting weights: ", liftMin);
cout << endl;
double badCalBurn, runCalBurn, walkCalBurn, liftCalBurn;
calculateCalories(0.044, weight, badminMin, badCalBurn);
calculateCalories(0.087, weight, runMin, runCalBurn);
calculateCalories(0.036, weight, walkMin, walkCalBurn);
calculateCalories(0.042, weight, liftMin, liftCalBurn);
displayHeader(name);
string bad = "Badminton";
string run = "Running";
string walk = "Walking";
string lift = "Lifting Weights";
string total = "Total";
int hours, totalMin, minutes, badMinHours, badMinMinutes, runMinHours, runMinMinutes;
int walkMinHours, walkMinMinutes, liftMinHours, liftMinMinutes;
double totalCal;
totalMin = badminMin + runMin + walkMin + liftMin;
totalCal = badCalBurn + runCalBurn + walkCalBurn + liftCalBurn;
splitTime(badMinHours, badMinMinutes);
splitTime(runMinHours, runMinMinutes);
splitTime(walkMinHours, walkMinMinutes);
splitTime(liftMinHours, liftMinMinutes);
splitTime(hours, minutes);

displayLine(bad, badMinHours, badMinMinutes, badCalBurn);
displayLine(run, runMinHours, runMinMinutes, runCalBurn);
displayLine(walk, walkMinHours, walkMinMinutes, walkCalBurn);
displayLine(lift, liftMinHours, liftMinMinutes, liftCalBurn);
displayLine(total, hours, minutes, totalCal);


return 0;
}

void inputNumber(string prompt, int& value) {
cout << prompt;
cin >> value;

}

void calculateCalories(double rate, int weight, int minutes, double& calculate) {
calculate= rate * weight * minutes;
}

void splitTime(int& hours, int& minutes) {
hours = minutes / 60;
minutes = minutes % 60;
}
void displayHeader(string personName) {
cout << "Here are the results for: " << personName << endl;
cout << left << setw(20) << "Activity" << setw(10) << "Time" << setw(5) << "Calories" << endl;
cout << "---------------------------------------------" << endl;

}
void displayLine(string activity, int hours, int minutes, double calories) {

cout << left << setw(20) << activity << setfill(' ') << hours << ":" << setw(2) << right << setfill('0') << minutes << setfill(' ') <<
setw(13) << setprecision(3) << fixed << calories << endl;
1
2
3
4
splitTime(badMinHours, badMinMinutes);
splitTime(runMinHours, runMinMinutes);
splitTime(walkMinHours, walkMinMinutes);
splitTime(liftMinHours, liftMinMinutes);


What do you think the values of badMinHours, badMinMinutes, runMinHours, ... are?
the assignment is supposed to create a function called splitTime to calculate the hours and minutes of an event. Instead of returning a value, the want us to use reference variables as show here:

void splitTime (int& h, int&m){
h = m / 60; //this will divide to get the hours if applicable
m = m% 60; //this should display the minutes
}

they want us to display the time by calling the splitTime function. for example: if the amount of time spent playing badminton is 63 minutes, it should display 1:03, etc;
Yes, the function splitTime looks ok. I was refering to the input parameters that just had random values.
int hours, totalMin, minutes, badMinHours, badMinMinutes, runMinHours, runMinMinutes;
int walkMinHours, walkMinMinutes, liftMinHours, liftMinMinutes;
inputNumber("Please enter the minutes spent playing badminton: ", badminMin); Sp badminMin is the number of minutes spent playing badminton

int hours, totalMin, minutes, badMinHours, badMinMinutes, runMinHours, runMinMinutes; Now you declare another variable with nearly the same name.
 
 splitTime(badMinHours, badMinMinutes);
and you pass that uninitialized variable into splitTime.

So you just need to remove the unnecessary variable and use the right one.
thank you for the help I was able to figure it out
Topic archived. No new replies allowed.