Include the for loop below in a small program and complete the program. The loop should execute 10
times. Do not change the for loop below. Compile and run your program to see for yourself that it works.
You do not have to submit this program and output.
for (int i = 1; i <= n;
i++) cout << i * i;
Now convert the for loop into a while loop and add any variable initialisations that you think are
necessary. Compile and run your program and submit only the program containing the while loop and its
output
You are requested to write a very simple calculator. Calculator should be able to handle the five basic mathematic operations – add, subtract, multiply, divide and modulus – on two input values. Your program should have the following structure:
Ask the user to enter two float variables named var1 and var2
Ask the user to enter a character variable named operation to represent the operation to be
performed on the two variables.
Perform the appropriate operation by using if-statements
The output must be given in fixed-point notation with two digits after the decimal point
Teacher at Leva P School needs to divide her class in different group sizes due to activity they have to do. Help her to prepare workstations for each group. For art projects the class divided in groups of 6; science projects in groups of 4. She asked to write program to get number of groups and number of pupils left to form a smaller group. There are 56 pupils in the class.
Declare three int variables nrPupils, nrGroups, and nrLeft. nrPupils represents the
number of pupils in a class, nrGroups number of groups the class divided into, and nrLeft number of pupils remaining smaller group. Assign the value 56 to nrPupils. Declare an int variable groupSize that is used by a cin statement to input a value from the keyboard and store the size of the groups the teacher requested. Display an appropriate message. Please enter the size of each group? Write the statement to calculate the number of groups of groupSize. Write the statement to calculate the number of pupils who are in the remaining smaller group
You are requested to write a very simple calculator. Your calculator should be able to handle the five basic mathematic operations – add, subtract, multiply, divide and modulus – on two input values. Your program should have the following structure: • Ask the user to enter two float variables named var1 and var2 • Ask the user to enter a character variable named operation to represent the operation to be performed on the two variables. • Perform the appropriate operation by using if-statements • The output must be given in fixed-point notation with two digits after the decimal point.
Write a program to overload the expression (ob1*ob2) %ob3. Where ob1, ob2 and ob3 are the objects of a class. Assume 2 number of integer data members in the class.
In this program, you will develop a calendar application. Implement the following functionality:
1. Calculate difference between two dates - Take user input for both dates & calculate difference between them in months & days as well as weeks & days. For example, if the user enters x & y, display difference as: 39 months, 3 days, OR 78 weeks, 3 days
2. Calculate a future date - Take user input for start date & for number of weeks, months or days to add to it. The user can type “3 months”, “43 weeks” etc. & the program should interpret the text input correctly & add appropriate number of days to the start date. Display output in the form:
<user input> from the start date <user input> is <day of the week>, <day> <month>
<year>.
Use overloading of subtraction operator to implement data difference. Implement above member functions in at least a Date & Calendar class. The program should keep displaying options until user chooses to exit.
Write a program in c++ to implement the stack push 5 values (10,20,30,40,50,)in the stack them pops value and display the remaining stack value.
Construct a C++ program having base class Student consisting protected member’s student name, student reg, student branch and employee rno. Define a member function input() having void return type for initializing the above said data members. Use this class to create new class Result having data member subject name ,subject marks, total marks and grade that calculate the grade for each course by using marks range given below and print the grade of each course by defining member function output() with void return type. Total marks Grade Calcultion 95-100 ‘O’ 90-94 ‘A+’ 85-89 ‘A’ 80-84 ‘B+’ 70-79 ‘B’ 60-69 ‘C’ 40-59 ‘D’ <40 ‘E'
Use a while loop to find the smallest integer n such that 3n is greater than 30000
Write a program that displays the following table (note that 1 millimeter is 0.039 inches):
Millimeters Inches
2 0.078
4 0.156
…
96 3.744
98 3.822