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

Write a C++ program to convert velocities to alternate units as described below:

ID: 3869288 • Letter: W

Question


Write a C++ program to convert velocities to alternate units as described below: Use a single 2D array with 3 columns and 21 rows for the velocity value as follows: column 0 - velocity in mi/h (mph) column 1 - velocity in ft/s The 3D array is illustrated below where velocity varies from 0 - 100 mi/h: Use a loop or a list to assign the velocity values to column 0. Use loop to calculate and assign the velocities in columns 1 and 2. Neatly display the velocity in three columns with a table heading. Select a reasonable number of digits for each column.

Explanation / Answer

#include<iostream>
#include<iomanip>

using namespace std;

int main(){

   int vel[21][3];

   for (int i = 0; i<21; i++){

       vel[i][0] = i*5;
       vel[i][1] = vel[i][0] * 1.60934;
       vel[i][2] = vel[i][0] * 1.46667;
   }

   cout << setw(10) << "Mph" << setw(15) << "Kmph" << setw(15) << "ftps" << endl;

   for (int i = 0; i<21; i++){

     cout << setw(10) << vel[i][0] << setw(15) << vel[i][1] << setw(15) << vel[i][2] << endl;
   }
  
  
   return 0;
}

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