int main () { const float sixty_sec =60; //sixty seconds constint one_mile = 528
ID: 3614514 • Letter: I
Question
int main ()
{
const float sixty_sec =60; //sixty seconds
constint //one mile is5280 ft
const int //one kilometer is 3281 ft
const int // one meter is 3.281 ft
charname1; //name of the runner beingenterd
floatmin; //minutes it took runner to runrace
float first_sec; // seconds it tookrunner to run
floatconverted_min; //converted min to seconds
floatft_per_sec; // converted tofeet per second
floatm_per_sec; //converted tofeet per second
cout<< "Enter name of the runner "; //entername of runner
cin >>name1; //name is input
cout<< "enter minutes"; // enter the minutes
cin >>min; // minutes
cout<< "enter seconds"; // enter seconds
cin >>first_sec; // seconds
//conversion of minutes to seconds
converted_min =(min * sixty_sec) + first_sec;
//conversion to feet per second
ft_per_sec = one_mile /converted_min;
//conversion to meters per second
m_per_sec = ft_per_sec /one_meter;
//output of feet per second and meters per second
cout << name1<< "ran " << ft_per_sec << "ft/sec and "<<
m_per_sec <<"m/sec " << endl;
return0;
}
Explanation / Answer
but you dont declare the size of character arrayname1 you write char name1; it means it has only space for one charcter only not for fullname you may write this as char name1[20]; here i declare size of char
so replace "char name1" with "char name1[20]" ;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.