In the following questions, use functions to implement the required tasks:
Q1:- Write a C++ code that read a string as an integer, then it will check it for any mistakes, then it will convert it to integer so you can use it in any arithmetic or logic operations. in this C++ code, to Program should give the user an error message when wrong entry is happen, and the program should keep asking the user to enter a valid entry. Also, use a function to implement the converting. (Use switch for the converting)
Q2:- Write a function Exaggerate that takes a string as a reference parameter and increases any non-nine digits in that string by one. For example, given the input string “I worked 90 hours and drove 24 miles” the function would change it to read “I worked 91 hours and drove 35 miles.
Q3:- Write a function InsertCommas that, given as a parameter a string containing mixed integer data and text, inserts commas into the integers to improve readability. For example, if the input is “1000000 melons,” you should return “1,000,000 melons.”
Q4:- Write a C++ code that read 10 different integers as a one dimension array and:
• Calculate the average of these values.
• Find the maximum value.
• Sort them from the smallest value to the greatest value.
Q5:- Write a program that declares a constant pointer to a constant integer. Initialize the pointer to an integer variable, varOne. Assign 6 to varOne. Use the pointer to assign 7 to varOne. Create a second integer variable, varTwo. Reassign the pointer to varTwo.
Q6:- Write a program that declares an int, a reference to an int, and a pointer to an int. Use the pointer and the reference to manipulate the value in the int.
Q7:- What is wrong with this code?
using namespace std;
*pInt = 9;
cout << “The value at pInt: “ << *pInt;
6. What is wrong with this code?
using namespace std;
int SomeVariable = 5;
cout << “SomeVariable: “ << SomeVariable << endl;
int *pVar = & SomeVariable;
pVar = 9;
cout << “SomeVariable: “ << *pVar << endl;
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.