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

C++ You should create a variable to store the total number of kilometers. We wil

ID: 3880192 • Letter: C

Question

C++

You should create a variable to store the total number of kilometers. We will name this variable kilometers. Initialize the variable at 5. (2 points) Create an equation that converts kilometers to miles. One kilometer is equal to 0.62137 miles. Save the result of this equation in a variable named miles. (3 points) Display the result using cout commands as shown below. Be sure to use the variables in your output instead of just typing in the answers. Let the computer figure out the answer.   (3 points) 5 kilometers = 3.10685 miles

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
   //variable declaration
   double kilometers,miles;
   kilometers =5;//initializing to 5
   miles = kilometers*0.62137;//equation
  
   //printing output
  
   cout<<kilometers<<" kilometers = "<<miles<<" miles ";
  
   return 0;
}

output:

5 kilometers = 3.10685 miles


Process exited normally.
Press any key to continue . . .

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