•Given an input number, print a pattern such that you subtract 3 from the input number and print it until it reaches zero or to a negative value. After that, you will add 3 to the number and repeat until it reaches the same input value
•E.g: n= 15 Output = 15 12 9 6 3 0 3 6 9 12 15
•E.g: n = 8 Output = 8 5 2 -1 2 5 8
Note: You are supposed to use the recursive method to solve this question.
You cannot use a loop for this task!
Add the ability to use {} as well as () in the program, so that {(4+5)*6} / (3+4) will be a
valid expression.
3. Add a factorial operator: use a suffix ! operator to represent “factorial.” For example, the
expression 7! means 7 * 6 * 5 * 4 * 3 * 2 * 1. Make ! bind tighter than * and /; that is,
7*8! means 7* (8!) rather than (7*8)!. Begin by modifying the grammar to account for a
higher-level operator. To agree with the standard mathematical definition of factorial, let
0! evaluate to 1. Hint: The calculator functions deal with doubles, but factorial is defined
only for ints, so just for x!, assign the x to an int and calculate the factorial of that int.
Write a program that reads digits and composes them into integers. For example, 123 is read
as the characters 1, 2, and 3. The program should output 123 is 1 hundred and 2 tens and 3
ones. The number should be output as an int value. Handle numbers with one, two, three, or
four digits. Hint: To get the integer value 5 from the character '5' subtract '0', that is, '5'–
'0'==5.
Create a Class Room_Area in C++ with following description: - Private data members: length (float):
to store the length of a room width (float): to store the width of a room Public member functions:
Set_data():- to input the values of length and width of a room. Print_data():- to display the values of
length and width of a room. Create a Friend function Area () to calculate the area of a rectangular room.
Invoke the member function and friend function in main() to provide the desired outputs.
Write a program which takes 10 numbers as input and then sort it using bubble
sort.
What the value will Newval have after this code has been executed?
Int var1 = 4;
Int var2 = 10;
Int Newval = 0;
If (var1 * 2 >=var2)
newval = 5 + 2 * var2;
Else if (var1 < var2)
newval = var2 - var1 * 2;
Else
newval = var1;
Sort a c++ program one and two and three dimensional array in ascending and descending order
13. An insurance company insured their driver in following case: - (i)Driver is
married, (ii)Driver is unmarried male and above 30 year (iii) Driver is unmarried
female and above 25 years. In all other cases the driver will not be insured. Write
a program to check whether a driver is insured or not on the basis of marital
status, sex and age.
Write a complete C++ program that uses a while loop to perform the following: • Input scores for CS411 exam for the students enrolled in CS411 course. User has to input number of students. • Find and display the total of the scores. • Find and display the highest and lowest scores. • Calculate and display the average of the scores. • Count and display how many students earned scores above and equal to 50 marks. • Count and display how many students earned scores below 50 marks. (Please do not include array. Thank you so much!)
Create a class which only works for absolute numbers, if it
encounters any negative occurrence, then it throw an exception to its
handler and display errors.