Answer to Question #242801 in C++ for Jun Hao

Question #242801

Question 2 Construct a C++ program to store the data in column X as an array, then process the data to obtain the data as in column Y and Z. Store the data as an array as well. X Y Z 0 100 95 2 98 93 4 96 91 6 94 89 8 92 87 10 90 85 … … … … … … 100 0 -5


1
Expert's answer
2021-09-27T01:55:02-0400
#include <iostream>
using namespace std;




int main(){
	int XYZ[101][3];
	int counterX=0;
	int counterY=100;
	int counterZ=95;
	for(int i=0;i<51;i++){
		XYZ[i][0]=counterX;
		XYZ[i][1]=counterY;
		XYZ[i][2]=counterZ;
		counterX+=2;
		counterY-=2;
		counterZ-=2;
	}
	cout<<"X Y Z\n";
	for(int i=0;i<51;i++){
		for(int j=0;j<3;j++){
			cout<<XYZ[i][j]<<" ";
		}
		cout<<"\n";
	}
	cin>>counterY;
	return 0;


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS