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

Implement destructor for the following class :

class List{
public:
int item;
int pos;
List* nextNode;
List()
{
this->pos=0;
}
List(int pos)
{
this->pos=pos;
}
List(int item,int pos)
{
this->item=item;
this->pos=pos;
}
List(List &list)
{

this->item=list.item;
this->pos=list.pos;

this->nextNode=list.nextNode;

}

};

What would the following program print out? (Answer without using a computer.)

1 void f( const int a = 5)

2 {

3 std :: cout << a*2 << " \ n";

4 }

5

6 int a = 123;

7 int main ()

8 {

9 f (1) ;

10 f (a ) ;

11 int b = 3;

12 f (b ) ;

13 int a = 4;

14 f (a ) ;

15 f();

16 }


Q3: Write a full program that adds three integers. Your solution should have a function named getSum that accepts three integer parameters and returns the sum of those three integers. Your main function should call the getSum function and assigns the return value to an int variable named result that is declared inside the main function. Your program should then print out the value stored in result. Submit the code and a copy of your output. Q4. Explain why, given your function from Q3, getSum(1,2,3.0) is a syntax error.


Write a full program that find the remainder. Your solution should have a function named findRemainder that accepts two integer parameters and returns the remainder. Your main function should call the findRemainder function and assigns the return value to an int variable named remainder that is declared inside the main function. Your program should then print out the value stored in remainder. Submit the code and a copy of your output.


Write a full program that adds three integers. Your solution should have a function named getSum that accepts three integer parameters and returns the sum of those three integers. Your main function should call the getSum function and assigns the return value to an int variable named result that is declared inside the main function. Your program should then print out the value stored in result. Submit the code and a copy of your output.


This assignment requires a C++ program be written to perform a vote counting and tallying procedure to gauge favorite holiday destinations of individuals. It should present the user with the question and a “ballot” of 5 holiday destinations and an exit/quit option. Once the program is started, it should allow the user to vote multiple times (same as in multiple users using the program to vote).

 For example, the voting options might look like: *********** FAVORITE HOLIDAY DESTINATION OPINION POLL ***********

1. London

2. Paris

3. Rome

4. Sydney

5. New Zealand

6. Quit voting Please choose your favorite holiday destination from the list above by number

Note that the sixth menu item is the option to quit voting. If this option is selected, voting results (as discussed in the next paragraph) need to be printed before the program terminates. Print the total number of votes, individual votes for each item, and percentages in an easy to read table. .


Problem 5: Write pseudocode of a program that takes a number that represents data_Type, another variable sign_Unsign to further classify the data type as signed or unsigned, and a number from the user. Verify if that number can be stored in that given data type. Range of each datatype is given in the table below.
Input:
1. Take data_Type from the user, if the user enters value other than 1 or 2 ask to input data_Type
again.
2. Take sign_Unsign from the user, if the user enters anyother value than 0 or 1 ask to input
sign_Unsign again 3. Take number (any)
1 – short int 0 - signed 2 byte 1 - unsigned 2 bytes 2-int 0-signed 4bytes 1 - unsigned 4 bytes
-32768 to 32767
0 to 65535
-2147483648 to 2147483647 0 to 4296967295
Data_Type
Sign_Unsign
Size
Range

Problem 5: Write pseudocode of a program that takes a number that represents data_Type, another

variable sign_Unsign to further classify the data type as signed or unsigned, and a number from the user.

Verify if that number can be stored in that given data type. Range of each datatype is given in the table

below.

Input:

1. Take data_Type from the user, if the user enters value other than 1 or 2 ask to input data_Type

again.

2. Take sign_Unsign from the user, if the user enters anyother value than 0 or 1 ask to input

sign_Unsign again

3. Take number (any)


Write a function that, when you call it, displays a message telling how many times it has been called: “I have been called 3 times”, for instance. Write a main() program that calls this function at least 10 times. Try implementing this function in two different ways. First, use a global variable to store the count. Second, use a local static variable. Which is more appropriate? Why can’t you use a local variable? 


Write a function called swap() that interchanges two int values passed to it by the calling program. (Note that this function swaps the values of the variables in the calling program, not those in the function.) You’ll need to decide how to pass the arguments. Create a main() program to exercise the function.


LATEST TUTORIALS
APPROVED BY CLIENTS