Get premium membership and access questions with answers, video lessons as well as revision papers.

Using the following class declaration, create a ten-element array, initialize num to the values 1 through 10, and itialize sqr to num's square. #include using namespace...

      

Using the following class declaration, create a ten-element array, initialize num to the values 1 through 10, and itialize sqr to num's square.
#include
using namespace std;
class square {
int num, sqr;
public:
square (int a, int b) {num=a; sqr=b;}
voshow() {cout <};

  

Answers


Davis
#include
using namespace std;
class square {
int num, sqr;
public:
squares(int a, in{num = a; sqr = b; }
void show() {cout <};
int main()
{
squares ob[10] = {
squares(1, 1), squares(2, 4(3, 9), squares(4, 16), squares(5, 25), squares(6, 36), squares(7, 49), squares(8, 64), squares(9, 81), squares(10, 100),
};
int i;
for( i=0; i<10; i++ ob[i].show();
return 0;
Githiari answered the question on May 31, 2018 at 17:27


Next: Using the following class declaration, create a ten-elment array and initialize the ch element with the values A through J. Demonstrate that the array does,...
Previous: Describe the advantages of being a social enterprise.

View More Computer Studies Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions