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

3. (22 pts) Matrix of temperatures: Write a C++ program to repeat problem 4 from

ID: 3698500 • Letter: 3

Question

3. (22 pts) Matrix of temperatures: Write a C++ program to repeat problem 4 from the Chapter 7 homework as follows: Use a single 2D array with 3 columns and 19 rows for the temperature values, where the Farenheit values are stored in column 0, the Celcius values are stored in column 1, and the Kelvin values are stored in column 2. This is illustrated below: . 32 42 62 72 82 92 102 182 202 Use a loop or a list to assign the Farenheit values to column 0. Use a loop to calculate and assign the Celcius and Kelvin values to columns 1 and 2. Display the temperatures in three columns with a table heading.

Explanation / Answer

# include<iostream>

using namespace std;

void main(){

float tem[19][3];

cout<<"enter temperature in fahrenheit";

for( int i=0; i<19; i++) \ loop for 1 to 19th row

cin>>tem[i][0]; \ storing value in first column;

for( i=0; i<19; i++) {

tem[i][1] = (( tem[i][0] - 32)*5)/9; \ celcius calculation and storing in 2nd column;

tem[i][2] = (( tem[i][0] + 459.67)*5)/9; \ kelvin calculation and storing in 3rd column;

}

cout<<"Fahrenheit celcius kelvin";

for( i=0; i<19; i++)

cout<<tem[i][0]<<" "<<tem[i][1]<<" "<<tem[i][2];

}

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