Ok, makes sense now. You don't really need a function for # 3, as this is just a counter. For #4, I made a function called all_stages_completed(). Here's an example. Take what you have and add the function all_stages_completed() to your code. If you can think of a better name for it, use that. I didn't make a getname() function, but one could easily be added.
Code:
#include <iostream>
using namespace std;
bool all_stages_completed(int t1, int t2, int t3);
void calctotaltime(char name[], int t1, int t2, int t3);
int main(void)
{
char name[80];
int swim_time, run_time, cycle_time;
int total_competitors = 0;
int total_finishers = 0;
do {
cout << "Enter name:";
cin >> name;
if (strcmp(name,"end") == 0)
break;
total_competitors++;
cout << "Enter swim time:";
cin >> swim_time;
cout << "Enter run time:";
cin >> run_time;
cout << "Enter swim time:";
cin >> cycle_time;
if (all_stages_completed(swim_time,run_time,cycle_time))
{
calctotaltime(name,swim_time,run_time,cycle_time);
total_finishers++;
}
} while (true);
cout << "Total competitors:" << total_competitors << endl;
cout << "Total finishers:" << total_finishers << endl;
return 0;
}
void calctotaltime(char name[], int t1, int t2, int t3)
{
cout << "Total time for" << name << ":" << t1+t2+t3 << endl;
}
bool all_stages_completed(int t1, int t2, int t3)
{
if (t1 > 0 && t2 > 0 && t3 > 0)
return true;
else
{
cout << "Total time not completed." << endl;
return false;
}
}