#include<iostream> #include<stdlib.h> using namespace std; int main () //write t
ID: 3611775 • Letter: #
Question
#include<iostream>
#include<stdlib.h>
usingnamespacestd;
intmain() //write the main body
{
int size=0; //initialize the size
cout<<"Enter the value of size:"<<endl; //insert the size of the array
cin>>size; //print the size on thescreen
int*num; //an array of an integer type
num =newint[size];
for(count= 0; count< size;count++) //using forloop
{
cout<<"Enter value num"<<count+1<<endl; //Enter the number
cin>>num[count]; //Print the number
}
for(count= 0; count<< size;count++)
{
cout<<num[count]<<endl; //print the array
}//endfor
int*nextNum; //creat a pointer named nextNum of integer type
nextNum =newint[size*2];
for(count= 0; count< size;count++) //copy process
{
nextNum[count] = num[count];
}
delete[]num; //delete the memory that is allocated to thenum
for(intindex= count ; index< size*2;index++)
{
cout<<"Enter value num"<<index+1<<endl; //Enter the value of num
cin>>nextNum[index]; //print
}
for(count= 0; count< size*2;count++)
{
cout<<nextNum[count]<<endl; //print
}
delete[]nextNum; //delete the memory that is allocated to the nextNum
}
Explanation / Answer
you need to declare the variable count like this int count = 0; if it still does not compile, it would help if you tell uswhyRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.