NEED HELP PLEASE. I am stuck?
1. Ask for runner first and last name?
2. Ask for first minute strides=190
3. Last minute stride=207
4. Ask for total running time in format of h:mm
5. Time given is 1 hour and 23 minutes
6. Out a report with runner’s name, total time in h:mm, total feet, total miles?
7. Put average stride per minute, total strides, total miles as floating point and total minutes as an integer.
I tried to do it this way but got many errors and I can't understand it.
Please help me out?
//compiler directives
#include<iostream>
#include<string>
using namespace std;
//constant declaration
const int FEET_per_STRIDE=2.5;
const int FEET_per_MILE=5280;
const int MINUTES_per_HOUR=60;
//main body
int main()
{
//local identifiers
string FirstName, LastName, FullName;
int FirstMinuteStrides,LastMinuteStrides,Hours,Minutes;
//input module
cout << "Please enter your First Name: \t";
cin >> FirstName;
cout << FirstName <<", Please enter your last Name: \t";
cin >> LastName;
cout << "Please enter your first minute strides: \t";
cin >> FirstMinuteStrides;
cout << "Please enter your last minute strides: \t";
cin >> LastMinuteStrides;
cout << "Please enter your total time running in hour and minute: \t";
cin >> Hours, Minutes;
//processor module
FullName=FirstName+" "+LastName;
AverageStridesPerMinute=(First_Minute_Strides)/2;
int TotalMinutes=Hours*MINUTES_per_HOUR+Minutes
TotalStrides=Average_Strides_Per_Minute*Total_Minutes;
TotalFeet=Total_Strides*FEET_per_STRIDE;
TotalMiles=Total_Feet/FEET_per_MILE;
You have to declare your variables before you can use them.
in line 35, try:
double AverageStridesPerMinute=(LastMinuteStrides)/2.0;
Instead of:
AverageStridesPerMinute=(LastMinuteStrides)/2;
You can only used variables you've declared:
"First_Minute_Strides" is undeclared. It is not the same as as "FirstMinuteStrides" Which is what I think you actually mean.
The same goes for line 37 "Average_Strides_Per_Minute", it is NOT the same as "AverageStridesPerMinute"
You're missing the terminating semi colon in line 36
Total_Minutes, TotalFeet, Total_Strides, TotalMiles and Total_Feet are all undeclared.
You better not be trolling!
With these changes your code will compile and run, I can't sya anything about the correctness or logic.