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: 3757771 • 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 values as follows:

column 0 – velocity in mi/h (mph)

column 1 – velocity in km/h

column 2 – velocity in ft/s

The 3D array is illustrated below where velocity varies from 0 – 100 mi/h:

0

5

10

15

20

25

30

35

40

45

50

55

60

65

70

75

80

85

90

95

100

Use a loop or a list to assign the velocity values to column 0.

Use a 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.

Plaese use basic on the basic library functions;

<iostream>; <cctype>; <cmath>; <iomanip>; <string>; <sstream>

As I'm very new to this world

Thank You, much appreciated! -tyler

0

5

10

15

20

25

30

35

40

45

50

55

60

65

70

75

80

85

90

95

100

Explanation / Answer

#include <iostream>
using namespace std;
int main(){
   double a[21][3];
   int i=0,j=0;
   double start=0.000,end=100.000;
   for(i=0;i<21;i++){
       a[i][0]=start;
       a[i][1]=1.609344 * start;
       a[i][2]=1.46666667 * start;
       start=start+5.000;
       }
   cout<<"Velocity in mi/h "<<"Velocity in km/h "<<"velocity in ft/s ";
   for(i=0;i<21;i++){
       cout.precision(3);
       cout<<" "<<a[i][0]<<" "<<a[i][1]<<" "<<a[i][2]<<endl;
   }
}

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