Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

/ This program demonstrates the use of dynamic variables // Fill in the code for

ID: 3629545 • Letter: #

Question

/ This program demonstrates the use of dynamic variables
//Fill in the code for the bold part, some already i done check see that i did it correct please, thanks


#include <iostream>
using namespace std;
const int MAXNAME = 10;
int main()
{
int pos;
char * name;
int * one;
int * two;
int * three;
int result;
*)malloc(sizeof(int));// Fill in code to allocate the integer variable one here
two = (int *)malloc(sizeof(int));// Fill in code to allocate the integer variable two here
three= (int *)malloc(sizeof(int));// Fill in code to allocate the integer variable three here
char= ( char *)malloc(10*sizeof(char));// Fill in code to allocate the character array pointed to by name


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;
for (pos = 0; pos < MAXNAME; pos++)
cin>> // Fill in code to read a character into the name array
// WITHOUT USING a bracketed subscript


cout << "Hi ";
for (pos = 0; 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

cin>>a

cin>>b

cin>>c;

*one=a;

*two=b;

*three=c;

cout << "The three numbers are " <<*one<<*two<<*three endl;
// Fill in code to output those numbers
result = *one + *two + *three; // 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
free(one);

free(two)

free(three);
return 0;
}

Explanation / Answer

i think you are using c++ then again y u are using malloc ???

if u want in C what u wrote is correct.