Assignment-1
Assignment-1
Q.1. Write a program that lets the user perform arithmetic operations on two numbers.
Your program must be menu driven, allowing the user to select the operation (+, -, *, or
/) and input the numbers. Furthermore, your program must consist of following
functions:
1) Function showChoice: This function shows the options to the user and explains how to
enterdata.
2) Function add: This function accepts two number as arguments and returns sum.
3)Function subtract: This function accepts two number as arguments and returns their
difference.
4) Function multiply: This function accepts two number as arguments and returns product.
5) Function divide: This function accepts two number as arguments and returns quotient.
c) int x = 10;
cout << ++x;
d) int x = 10, y;
y = x++;
cout << x;
Q.3 Write a program to check character entered is alphabet, digit or special character
using library functions.
Q.4 Write a program which input three numbers and display the largest number using
ternary operator.
Q.5 Write a program which accepts days as integer and display total number of years,
months and days in it. for example: If user input as 856 days the output should be 2 years
4 months 6 days.