Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/ / This program demonstrates the use of dynamic variables / / PLACE YOUR NAME HERE #include using namespace std; const int MAXNAME = 1
This program demonstrates the use of dynamic variables
PLACE YOUR NAME HERE
#include
using namespace std;
const int MAXNAME ;
Lesson A
int main
int pos;
char name nullptr;
int one nullptr;
int two nullptr;
int three nullptr;
int result;
Fill in code to allocate the integer variable one here
Fill in code to allocate the integer variable two here
Fill in code to allocate the integer variable three here
Fill in code to allocate the character array pointed to by name
cout "Enter your last name with exactly characters." endl;
cout If your name has characters, repeat last letter. endl
"Blanks at the end do not count." endl;
for pos ; pos MAXNAME; pos
cin Fill in code to read a character into the name array
WITHOUT USING a bracketed subscript
cout Hi ;
for pos ; pos MAXNAME; pos
cout Fill in code to a print a character from the name array
WITHOUT USING a bracketed subscript
cout endl "Enter three integer numbers separated by blanks" endl;
Fill in code to 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
echo print
cout "The three numbers are endl;
Fill in code to output those numbers
result Fill in code to calculate the sum of the three numbers
cout "The sum of the three values is result endl;
Fill in code to deallocate one, two, three and name
return ;
Exercise : Complete the program by filling in the code. Areas in bold
This problem requires that you study very carefully the code already
written to prepare you to complete the program.
LESSON SET Pointers
Sample Run:
L E S S O N B
Exercise : In inputting and outputting the name, you were asked NOT to use
a bracketed subscript. Why is a bracketed subscript unnecessary?
Would using namepos work for inputting the name? Why or why not?
Would using namepos work for outputting the name? Why or why not?
Try them both and see.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started