Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2) Write three functions (Should use #define for all literal numbers) a. main fu

ID: 3629353 • Letter: 2

Question

2) Write three functions (Should use #define for all literal numbers)
a. main function
i. Asks the user for the number of hours
ii. calls the function (convert_time) that takes the hours and returns its value in terms of seconds
iii. display the seconds

b. convert_time
i. Takes the hours and converts it to minutes
ii. Calls another function (convert_second) that takes the minutes and returns its value in terms of seconds
iii. Returns the seconds
c. convert_second
i. Takes the minutes and converts it to seconds
ii. Returns the seconds

Explanation / Answer

please rate - thanks

1)

#include <iostream>
using namespace std;
#define sec 60
int convert_time(int);
int main()
{int h;
cout<<"how many hours? ";
cin>>h;
cout<<h<<" hours is "<<convert_time(h)<<" seconds ";
system("pause");
return 0;
}
int convert_time(int h)
{int min=h*sec;
return min*sec;
}

2)

#include <iostream>
using namespace std;
#define sec 60
void convert_time(int);
int convert_second(int);
int main()
{int h;
cout<<"how many hours? ";
cin>>h;
convert_time(h);
system("pause");
return 0;
}
void convert_time(int h)
{int min=h*sec;
cout<<h<<" hours is "<<convert_second(min)<<" seconds ";
}
int convert_second(int m)
{return m*sec;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote