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
Calculator should be able to handle the five basic mathematics operations – +,-,*and divide and modulus – on two input values. 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. A typical run is displayed below: Please enter the first float value: 35.6 Please enter the second value: 24.12 Please enter the operation required : The sum of 35.6 and 24.12 is 59.72 Submit both your program and output.
Taru exam is on the head. So she started learning physics. There she learned about Pascal's law. Now she wanted to try an experiment to get a better understanding of the same.
For, the experiment Taru has N buckets (numbered from 1,2,3...N) which all are initially empty.
She has M number of queries. Each query represents an integer that is of 4 types.
•
searchBook( )
–
for a searching book by name or author. It asks the user to enter the
type of search he/she wants i.e. by Book name or by author name.
Design a C++ program that takes character input from user and checks whether that letter is vowel alphabet or not using if...else statement
1. Write a simple decryption program using string functions which will apply the Substitution Method. Here is the given Substitution Table.
1. Write a program using string functions that determine if the input word is a palindrome. A palindrome word is a word that produces the same word when it is reversed.
Write a program using standard string functions that
accepts a price of an item and display its coded value. The
base of the key is:
X C O M P U T E R S
0 1 2 3 4 5 6 7 8 9
Write a program to read the content of a file and copy its content to another file after converting all the capital case letters in the file to small case letters.
The following code is supposed to display the positive even numbers less than 12. That is, it will
output the numbers 2, 4, 6, 8 and 10. However, there is a logical error in the code. Explain what the output
of the code below will be. Then write a small program including the code below and make the necessary
changes to fix the code so that it displays what it is intended to display. Ensure that your program works
correctly. Only submit the program, not the output.
Hint: Use variable diagrams to trace the program to help you find the logical error.
int x = 1;
while (x
!= 12)
{
cout << x <<
endl; x = x +
2;
}