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

Differentiate between function overriding and function overloading.

If a program can be written using function overloading and using default arguments,which one is preferable?Explain giving example.

 

 Write overloaded functions to find the area of scalene,isosceles and equilateral triangle.

Area of scalene triangle = √(s(s-a)(a-b)(s-c))

Area of isosceles triangle = ½[√(a2 − b2 ⁄4) × b]

Area of equilateral triangle= (√3/4)a2 



Write a c program to search page 11 in a book where you don’t visit every page from 1 to 50. You open any random page in the book and check its page number. If the current page number is greater than 11, then 11 is on the left side of the current page.

 Create a class which stores a string and its length as data members. Include all the constructors. Include a member function to join two strings and display the 

concatenated string. 

Write a program to create a class that stores name and subject marks of two students. Using dynamic constructor allocate name and subject marks. Display the details along with average mark.

Write a program in which you have to find the 'volume and Area of 5 Rooms' by using class and objects


Write the code for the following problem using either C or C++. If there are 8 cars with its car number {11,10,34,56,68,89,65,78} parked in a parking area, then you are looking for a car number 68 by checking every car sequentially from the beginning.


A small business wants to create a file to store its customer information. Each record in the file is to

contain the following data: customer ID number, first name, last name, city, zip code, and account balance.

Write a program to create such a customer file named “customer.txt”. Write the file with space-separated

fields.

Write another program that displays the contents of the file “customer.txt” in column form with

appropriate column headings.



A moving contractor wants you to write a program that he can use to estimate the cost

of moving a residential customer. The charge for moving is based on two factors.

First, the labor cost is estimated by charging $4.00 for every 100 pounds of furniture to

be moved.

Second, the travel charge is $50.00 plus $1.75 for each mile the furniture is to be moved.

The program should prompt the user for the estimated weight of the furniture and the

distance the furniture is to be moved.

Finally, the program should display the labor charge, the travel charge, and the total

charge.



Create a file manually with the file name and contents shown below. The file contains records of student

name, age, sex, and favorite subject unit code.

Record.txt

Wong 18 M ATGE3022

John 19 M ATGE2222

Shirley 20 F ATGE2053

Tan 20 F ATGE1234

Lee 21 M ATGE2053

Chin 18 F ATGE2053

Chan 21 M ATGE2053


Write a program that reads the contents of the file and display the following result on the screen:

i) Total numbers of female whose favorite subject unit code is ATGE2053

ii) Total numbers of male whose favorite subject unit code is ATGE2053


Create a class which stores account number, customer name and balance. Derive two classes from ‘Account’ class: ‘Savings’ and ‘Current’. The ‘Savings’ class stores minimum balance. The ‘Current’ class stores the over-due amount. Include member functions in the appropriate class to:-

  • Deposit money
  • Withdraw [For saving account minimum balance should be checked.]

&,[For current account overdue amount should be calculated.]

  • Display balance
LATEST TUTORIALS
APPROVED BY CLIENTS