+ 2
A C++ program to copy the content of an array into another array
7 Respostas
+ 10
welcome..
one note for header file just put
#include<iostream>
instead of #include<iostream.h>
+ 9
let for an integer array of size 5:
#include<iostream.h>
using namespace std;
int main(){
// declare first array
int arr1[5];
/* declare another array of greater than or equal size and same type */
int arr2[5];
// insert the value of the first array
for(int i =0; i < 5; i++){
cout <<"insert the value of arr1["<<i+1<<"] =";
cin >> arr1[i];
}
/* asign the values of the 1st array to the second one. */
for(int i =0; i < 5; i++){
arr2[i] = arr1[i];
}
return 0;
}
+ 9
because we did not try to output it.
add this loop to the end of the programm to get the values of arr2
cout << "\n\nThe values of arr2 are:" << endl;
for(int i =0; i<5; i++){
cout << "arr2[" << i+1 << "] = " << arr2[i]<< endl;
}
+ 1
Thanks..... I would run it in the morning
0
Please help me out
0
But the output is not specified..... Did you try running it