Question: This program must be written in C++: Fill in the code below as indicated in the comments. This program demonstrates the use of dynamic variables
This program must be written in C++:
Fill in the code below as indicated in the comments. This program demonstrates the use of dynamic variables.
#include
using namespace std;
const int MAXNAME = 10;
{
int pos, result;
char *name = nullptr;
int *one = nullptr;
int *two = nullptr;
int *three = nullptr;
// allocate the character array pointed to by name
// and read the characters into the name array
// WITHOUT USING a bracketed subscript
cout << "Enter your last name with exactly 10 characters."
<< endl;
cout << "If your name has < 10 characters, repeat last letter. "
<< endl << "Blanks at the end do not count." << endl;
// print the array characters one at a time
// WITHOUT USING a bracketed subscript
// allocate the integer variables one, two, three
// input three numbers and store them in the dynamic variables
// pointed to by pointers one, two, and three. You are working
// only with pointer variables
// calculate the sum of the three numbers, store it in result,
// then output those three numbers and their sum
// deallocate one, two, three and name
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
