1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
galben [10]
3 years ago
13

What is the output of the following program? #include using namespace std; class TestClass { public: TestClass(int x) { cout &lt

;< x << endl; } TestClass() { cout << "Hello!" << endl; } }; int main() { TestClass test; return 0; }
Computers and Technology
1 answer:
Lunna [17]3 years ago
6 0

Answer:

The answer is "Hello!".

Explanation:

  • In the given C++ language program, a class "TestClass " is defined, which contains a parameterized constructor and default constructor.
  • In the parameterized constructor an integer variable "x" is passed in the constructor parameter and inside a constructor parameter value is print. Inside the default constructor, a print function (cout) is used that print message "Hello!".
  • In the main method, a class "TestClass" object is created that is "test" when a class object is created it automatically called a default constructor that's why the output to this code is "Hello!".

You might be interested in
Two middle-order batsmen are compared based on their performance in their previous cricket match.
Zolol [24]
How many points is this for
5 0
4 years ago
January 19/May 16 2022
fenix001 [56]

Answer:

This should get you started. Many things could be improved. You could keep adding layers to this program if you wanted to, so I wrote it with that in mind.

The new salary depends on the employee's department and current salary. I created a class that represents each employee. The function looks at the employee's current salary, and looks up what the employee's department raise will be (using the dictionary/hash table) before performing the calculation.

3 0
2 years ago
Write a C program to show sum of 10 elements of array and show the average.
ipn [44]

Answer:

// C program to find sum and average of 10 elements.

#include <stdio.h>

// main function

int main(void) {

   // array

double arr[10];

// variables

double average,sum=0;

int i;

   // ask to enter 10 elements of the array

printf("Enter 10 elements of the array:");

for(i=0;i<10;i++)

{

    // read elements of the array

    scanf("%lf", &arr[i]);

    // calculate the sum of elements

    sum=sum+arr[i];

}

// fint the average

average=sum/10;

// print sum

printf("Sum of 10 elements of the array is:%f ",sum);

// print average

printf("\nAverage of 10 elements of the array is:%f ",average);

return 0;

}

Explanation:

Create an array of size 10.Then read 10 values from user and store them into  array.Find the sum of 10 elements of the array and assign it to variable "sum". Find the average by dividing sum with 10.Print the sum and average.

Output:

Enter 10 elements of the array:3 2 4 5 1 4 8 9 12 10                                                                      

Sum of 10 elements of the array is:58.000000

Average of 10 elements of the array is:5.800000

8 0
3 years ago
The position of an element in the periodic table depends on​
shutvik [7]

Answer:

Electrons

Explanation:

Hope it helps

7 0
3 years ago
Sorting data in Excel Online hides content that does not fit your criteria. True False
Katarina [22]

False, sorting doesn't hide them

6 0
4 years ago
Read 2 more answers
Other questions:
  • Which presenter would most likely benefit from a custom slide show?
    15·1 answer
  • If x is an int, which of the following statements adds 5 to the current value of x and stores the new value back in x?
    12·1 answer
  • In this lab you used the sharing and storage management console to create a simple volume. what must you do to create a differen
    13·1 answer
  • Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of
    9·1 answer
  • What is MS-Word? Write some versions of MS-Word.
    8·2 answers
  • Who here has a crush on jk from bts but feels more mature than him
    10·2 answers
  • Where does Reiner take eren after they have a fight?
    7·2 answers
  • How do i know my child's login info for parent infinite campus
    14·1 answer
  • Fish Aquarium System of functional and Non-Functional requirement of the system.
    14·1 answer
  • To have the full protection of the law, copyrights, patients, and ______ should be registered with the government.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!