C++ In this exercise, you will create a program that displays a table consisting
ID: 3790782 • Letter: C
Question
C++
In this exercise, you will create a program that displays a table consisting of four rows and three columns. The first column should contain the numbers 10 through 13. The second and third columns should contain the results of squaring and cubing, respec- tively, the numbers 10 through 13. The table will look similar to the one shown in Figure 9-38. If necessary, create a new project named Introductory16 Project, and save it in the Cpp8Chap09 folder. Enter your C++ instructions into a source file named Introductory16.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program appropriately.
Explanation / Answer
As no format was given in question I have used mine
#include <iostream>
using namespace std;
int main()
{
cout << "|-----------------------| ";
cout << "| number|square |cube | ";
cout << "|-----------------------| ";
for (int i = 10; i <= 13; i++)
{
cout << "| " << i << " |";
cout << i*i << " |";
cout << i*i*i << " |";
cout << endl;
}
cout << "|-----------------------| ";
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.