Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Write a C++ program that swaps values of two float type variables A and B.

For swapping you can


use third variable temp to store values temporary. All accesses to the variables (A, B, and temp)
should be made through pointer notation only. In the end, print the values of variables (A, B) on the
screen. Please also note that during input (cin) and output (cout) the variables must be accessed
through pointers only.

Write a C++ program that asks the user to enter a string value in a variable named “Str”. The input
string should be of size 20 characters (minimum). Next, apply following operation (in sequence) on
the input string:
1) Find and print the length of the string.
2) Display string in reverse order.
3) Concatenate “Hello World” to the string.
4) Count number of words in updated string. 5) Convert whole string in lowercase

You might also like