ii. Write a program in C++ with the following datatypes. Use the 3 different variables with the same data type. Explain the codes step by step.
a. int
b. float.
c. double. d. string. e. bool.
Question 1 (30 marks) 100-500 words per explanation and avoid plagiarism.
i. Explain the following datatypes in your own words without copying it from
anywhere.
a. int
b. float.
c. double. d. string. e. Bool.
Then write a cpp program that outputs get mortality rate etc . derive a class hierarchy for the item set given below
Item sets
Virus , CovidVirus , HivVirus , BirdFlue etc | Virtual Function int GetMortalityRate();
The program below computes the grade of five students based on the marks scored. Study it carefully, identify the different errors the program has, correct the errors and hence re-write the program so that it can run successfully without errors.
Implement stack using linked list
Perform basic operations of stack and use menu to call the functions in main.
Note:
No global declarations
Make uses of classes/struct
create a calculator with all operations and contain round and square parentheses use a minimum of 3 classes the classes should contain at least one dynamically allocated char array, a dynamically allocated numerical array, a constant field, a static field, and a static method. The members should be class-related.
For examples of inputs:
1- [(2*3)^2]/4-(6+2)#3, where x^y means x at power y and x#y means y order root from x, will output 7 .
2- [4+(5-1)]*2 should output 16
The calculator will take the input from the console. The user will have the ability to write equations and entering the app will display the result. The calculator will accept input until the user types ‘exit’.
Write a program to display the month name as the user enters a number from 1 to 12 .Hint use switch statement…(1-september,2-october,…..)
Write an if-else statement that outputs the word High if the value of the variable score is greater than 100 and Low if the value of score is less than100. The variable score is of type int.
Write the following program in c++.
i. Create a class of your own choice with 5 attributes.
ii. Create an object of named objone in the intmain() function
iii. Access attributes and set values for all the 5 attributes
iv. Print all the attribute values
v. Create a function in the class that add two number and access the function using the oblject.
Write a C++ program that displays the row numbers of a matrix containing at least two even numbers. First, the program should create a 2D array (5 rows, 5 columns). Then, ask the user to input values in the matrix or 2D array. After that, program should display row number (or index) which has less than 2 prime numbers. If no row (of the matrix) contains at least two prime numbers then the program should display the message “No row found containing two prime numbers”.