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

3. Read strings from standard input and wite to a file, read the info from the file and print to console.


2. Accept a month as number (eg: 3 is March), and print month name. Any invalid month should throw an exception, โ€œMonth Errorโ€. The program should continuously ask the user to enter the month until the user choses to exit.


1. Accept two numbers a,b from the user and print a/b. If b is entered as zero, handle the exception and print appropriate message. Use, try, catch ,throw keywords



1. Accept two numbers a,b from the user and print a/b. If b is entered as zero, handle the exception and print appropriate message. Use, try, catch ,throw keywords

2. Accept a month as number (eg: 3 is March), and print month name. Any invalid month should throw an exception, โ€œMonth Errorโ€. The program should continuously ask the user to enter the month until the user choses to exit.

3. Read strings from standard input and wite to a file, read the info from the file and print to console.


Write a program to create a class called employee, the class



has members , name , ID, and salary, a constructor to enter values



from users, and member function to display the result of the



following equation:



๐‘€ =



๐‘†๐‘Ž๐‘™๐‘Ž๐‘Ÿ๐‘ฆ



---------โˆ— 15



100

Faisal bank need a ATM machine. In this machine they need to add all possible currency divisions (1, 2, 5,


10, 20, 50, 100, 500, 1000, 5000). Write a C++ program in which, take required amount from user and find


the required currency division which will give to user in order to pay the required amount.


Example:


Sample input:


Enter required amount: 7895


Required currency division is:


5000: 1


1000: 2


500: 1


100: 3


50: 1


20: 2


10: 0


5: 1


2: 0


1: 0

A carpenter wants to make a bed set; he wants to calculate the required wood for it. 10.5 sq foot wood


required for side tables. 15 sq foot required for dressing table and 35.75 sq foot wood required for bed.


Cost of each sq foot is 5000. Write a C++ program in which, take number of bed set required and calculate


the total required wood and total cost of wood.


Example:


Sample input:


Enter required number of bed set: 3


Sample output:


Total bill is: 918750

In the month of RAMZAN people distribute food packages. Carrefour offers a food package which contains



the following items 10kg flour, 5kg rice, 5ltr oil, 2pack salt and 500gm spices. Price of above items are:



1. Flour per kg 95



2. Rice per kg 210



3. Oil per liter 410



4. Salt per pack 50



5. Spices per 10 grams 5



Write a C++ program in which, take number of required bag from user and calculate the total price of



required packages and display it on console.




Faisal bank need a ATM machine. In this machine they need to add all possible currency divisions (1, 2, 5,



10, 20, 50, 100, 500, 1000, 5000). Write a C++ program in which, take required amount from user and find



the required currency division which will give to user in order to pay the required amount.

Write a program to try-catch blocks can be nested. Also ,an exception can be re-thrown using thrown

LATEST TUTORIALS
APPROVED BY CLIENTS