Questions: 11 448

Answers by our Experts: 10 707

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!

Search & Filtering

Consider following code and state the order of execution constructors and order

of execution of destructors.

class C: public A, virtual public B

{ public:

C( ):A( ),B( )

{

cout<<”c class constructor”;

}

};


Consider following code and state the order of execution constructors and order

of execution of destructors.

class C: public A, virtual public B

{ public:

C( ):A( ),B( )

{

cout&lt;&lt;”c class constructor”;

}

};


Include the definition for the function ‘max_age’, in the program given below. The

function compares the data member age of the objects P1 and P2 and returns the

object having higher value for age.

class person

{ int age;

public:

person(int a){age=a;}

};


int main()

{ person P1(1.5);

person P2(2.5);

person P3=P1.max_age(P2);

}


Find the errors in the following program and correct them.

[Assume the necessary header files and namespaces included]

class test

{ static int x;

int y;

public:

test( ){x=0;y=0;}

static void display()

{ cout&lt;&lt;x&lt;&lt;”\t”&lt;&lt;y&lt;&lt;endl; }

void output()

{cout&lt;&lt;x&lt;&lt;”\t”&lt;&lt;y&lt;&lt;endl;}

};

int main()

{ test T1;

T1.display();

test::output();

return 0;

}


Create a class ‘Book’. Derive two classes from it namely ‘’Print_Book’ and

‘E_Book’. Store the following details about the book in the relevant classes.

Title, Author, Price, No of pages and Size in KB.

Input information for ‘m’ number of print books and ‘n’ number of eBooks and

display it.


WAP to create a class which stores a dynamic integer array and its size. Include all

the constructors and destructor in the class. Store two arrays of different size in

two objects. Join the two arrays and and store it in another object using a member

function.


Develop a program and algorithm to find the roots of the quadratic equation using bisection method.


Given a string on one line, a second string on a second line, and an integer index, insert the contents of the second string in the first string at the index specified. Then, output the result.

Ex: If the input is:

FuzzyBear

Wuzzy

5

the output is:

FuzzyWuzzyBear

Note: Using a pre-defined string function, the solution can be just one line of code.


#include <iostream>

#include <string>

using namespace std;


int main() {

string workStr;

string otherStr;

int strPos;


getline(cin, workStr);

getline(cin, otherStr);

cin >> strPos;


cout << workStr << endl;

return 0;

}


WAP to create the classes as per the hierarchy shown below.Include the data

members in the relevant classes to store the following information:-

Name, Id, No of matches played,No. of runs scored, No. of wickets taken.

Calculate the batting average and wickets per match for an all rounder player.Use

parameterized constructor to initialize the object.

[ Batting average=No. of runs scored/No. of matches played

Wickets per match= No. Of wickets taken/ No. of matches played ]


An arrayList is one of the most important data structures used in many applications. Define and show the implementation of the functions of an arrayList


LATEST TUTORIALS
APPROVED BY CLIENTS