Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void fillArray(int* array, int& arrLength)
- {
- for (int i = 0; i < arrLength; i++)
- {
- *array = i + 5;
- array++;
- }
- }
- void printArray(int* array, int& arrLength)
- {
- cout << "Matrix: " << endl;
- for (int i = 0; i < arrLength; i++)
- {
- cout << *array << endl;
- array++;
- }
- }
- void v_alloc_table_add_5(int iSize)
- {
- int *arr;
- arr = new int[iSize];
- fillArray(arr, iSize);
- printArray(arr, iSize);
- delete[] arr;
- }
- int main()
- {
- int *iSize = new int;
- cout << "Enter the size of the array" << endl;
- cin >> *iSize;
- while (*iSize < 0)
- {
- cout << "The size can not be less then zero. Try once again" << endl;
- cin >> *iSize;
- }
- v_alloc_table_add_5(*iSize);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment