C++ Answers

Questions answered by Experts: 9 913

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

program to display, name ,contact, national card number, and the conversional summary



Write a Program in C++ to enter the record of 100 Students using structure pointer as a function parameter.

Fields for structures are: “std_name”, “std_id”, “std_roll_no”, “std__gpa” & “std_award”;

apply a check such that those students having gpa greater or equal to 3.5 so that these students will get Rs. 10,000/- per semester as a scholarship amount



Find the output of the following program. Find errors if any and correct it.


class test

{ int x;

 public:

test(int x)

{x=x; }

void display()

{cout<<x;}

};

int main()

{  test T1(5);

   T1.display();

   return 0;

}


[Assume the necessary header files and namespaces included]

 




Consider the code snippet given below:-

 [Assume the necessary header files and namespaces included]

int main()

{ int a[10];

 cout<<”enter the elements of the array\n”;

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

 cin>>a[i];

 

 

return 0;

}

 Complete the code such that the even and odd numbers from the array ‘a’ are stored into two different arrays. The size of these arrays should be same as that of the number of elements and their memory should be deallocated after displaying the odd and even numbers.


The following program has a bug when the user enters more than one name on the first

prompt. Execute the program by entering more than one string on the first prompt, observe

and state what is the bug on the program as a block comment, then modify the program to

fix the bug.

1 #include <iostream>

2 using namespace std;

3

4

5 int main(){

6

7 string name, surname;

8

9 cout<<"Please enter your name: ";

10 cin>>name;

11 cout<<"Please enter surname: ";

12 cin>>surname;

13 cout<<"Hi, "<<name<<" "<<surname<<endl;

14

15 return 0;

16 }


Write a Car class that holds the car name , year it was made and speed .The speed should be between 0 (minimum speed) and 225 (maximum speed) .Include the following functions;
*A function that will display information about the car such as name of the car , year it was made and the current speed.
*A function that will accept an argument,and use that value to increase the speed.if the increase of speed will result to a speed more than the maximum speed ,the spewed should be kept at the maximum speed.
*A function that will accept an argument , and use that value to decrease the speed .If the decrease of speed will result to a negative speed value , the speed should be kept at the minimum speed.
Write a main() function in which you declare one car object , and test (demonstrate) the class works correctly (I.e call the functions.)
Write a function that compares three integer parameters and returns the largest .Define your function after the main() function .Demonstrate that your function works correctly by creating at least one Animal object , and calling all the methods defined for the animal class
Write a program in which the main() method calls a method named evenOdd().The evenOdd() method takes one integers argument, and then display the sentence "The number is ODD " if The argument is an odd integer or "The number is EVEN" if the argument is even.

Write a C++ program that read numbers from an integer array and graph the information in the form of bar chat. Sample output is given below. Element Value Histogram 0 19 ******************* 1 3 *** 2 15 *************** 3 7 ******* 4 11 *********** 5 9 ********* 6 13 ************* 7 5 ***** 8 17 ***************** 9 1 *


An electricity board charges the following rates to domestic users to discourage large consumption of energy :For the first 100 units : 50 P per unit and Beyond 300 units : 60 P per unit, 100-300 units:55 pIf the total cost is more than Rs.250.00 then an additional surcharge of 15% is added on thedifference. Define a class Electricity in which the function Bill computes the cost


LATEST TUTORIALS
APPROVED BY CLIENTS