How can I solve this activity/ Write simpler code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I solve this activity/ Write simpler code

Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). (First code is the original) https://code.sololearn.com/cyy8560NO08o/?ref=app

15th Sep 2020, 3:47 AM
Addi Silva
Addi Silva - avatar
3 Answers
+ 2
Hy, You have to just define MphAndMinutesToMiles() function and return milesTraveled refer following code: https://code.sololearn.com/cXwVCgvT8576/#cpp
15th Sep 2020, 4:01 AM
AjayGohil
+ 1
Just declare & define a function with the name you want, if you want simpler code, you can make the function in only 1 line since the calculation only take double as the type (you also don't need to declare another variable, optional). The conclusion is, you just make a function with the name MphAndMinutesToMiles with double as its return type and both the parameters. Here's yours, edited: https://code.sololearn.com/ceX9YZ4egHaL/?ref=app
15th Sep 2020, 11:02 PM
LastSecond959
LastSecond959 - avatar
+ 1
thank you so much!!!!
17th Sep 2020, 2:28 AM
Addi Silva
Addi Silva - avatar