Arrays question
This is what I have so far but I was suppose to use a dynamic array not a normal one. How would I go about changing this to a dynamic array?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
using namespace std;
int main()
{
const int arraySize = 25;
const int patternSize = 10;
int arr1[arraySize] = {0,1,2,3,4,5,6,7,8,9};
for(int i=0; i<arraySize; i++)
{
cout << arr1[i%patternSize] << " ";
}
system("PAUSE");
return 0;
}
|
Syntax for "dynamic array": <type> <identifier>=new <type>[array size]
Topic archived. No new replies allowed.