1. Determine the output of each of the following program when it is executed. (a) #include #include using namespace std; struct abc { void display(); }; void abc :: display() { for (int i = 1; i ...




1. Determine the output of each of the following program when it is executed. (a)


#include #include using namespace std; struct abc {


void display();






};




void abc :: display()


{


for (int i = 1; i <=><=>


cout <><>


}


}




int main()


{










}


(b)




abc obj; obj.display(); return 0;




#include #include using namespace std; struct abc {


void display();


};




void abc :: display()


{


for (int i = 1; i <=>= 1; --j)


cout <><>


}


}




int main()


{










}


(c)




abc obj; obj.display(); return 0;




#include #include using namespace std; struct abc {


void display();


};




void abc :: display()


{


for (int i = 5; i >= 1; --i) { for (int j = i; j >= 1; --j)


cout <><>


}






}




int main()


{










}



(d)




abc obj; obj.display(); return 0;




#include #include using namespace std; struct abc {


void display();


};




void abc :: display()


{


for (int i = 5; i >= 1; --i) { for (int j = 1; j <=>


cout <><>


}


}




int main()


{










}



(e)




abc obj; obj.display(); return 0;




#include using namespace std; const int n = 10; class abc {


public:


int sum(int n);


};




int abc :: sum (int n)


{


int temp = 0;


for (int i = 0; i <=>


return (temp);


}




int main()


{


abc obj;


int total = obj.sum(n);


cout <><><>


}










(f)


#include using namespace std; ons tint n = 10; class abc {


public:


int sum(int a[], int n);


};




int abc :: sum (int a[], int n)


{


int temp = 0;


for (int I = 0; I <=>


temp += I;


}


return (temp);


}




int main()


{














}



(g)




abc obj;


int a[] = {1,2,3,4,5,6,7,8,9,10};


int total = obj.sum(a,n);


cout <><><>




#include using namespace std; class abc{


private:


int a; public:


int a;


void display();


};


void abc::display()


{


cout <><>


}


int main()


{


abc obj; obj.display(); return 0;


}










May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here