# dynamics

• Please tell me how to accomplish this task: It is not known how many users will lead the numbers and when they complete the introduction, we record the number of chips imposed and fill the masses that have been established. For example, 12 23 45 67 78,900 were introduced. There's a total of six numbers in place and we've got a mass out of these numbers. We need to implement without the use of vectors and classes, just basic concepts. You can use a dynamic mass.

• ### Code

``````#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
#define KEY_ENTER 13
int main()
{
string input;
int len = 0;
int* arr = new int[0];
while (true) {
if (_kbhit()) { // Когда клавиша нажата
int code = _getch(); // получаем код клавиши
if (code == KEY_ENTER) {
int inputLen = input.size();
cout << endl;
if (inputLen != 0) { // Если ничего не ввели
// Добовляем input в arr
len++;
int* lastArr = arr;
arr = new int[len];
for (int i = 0; i < len - 1; i++)
{
arr[i] = lastArr[i];
}
arr[len - 1] = stoi(input); // string -> int
} else {
// выводим массив
cout << "Array:";
for (int i = 0; i < len; i++)
{
cout << " " << arr[i];
}
return 1;
}
input = ""; // сбравываем input
}else{
input += (char)code; // добовляем нажатую клавишу к input
cout << (char)code;
}
}
}
}
``````

To complete the launch of the need to press Enter without adding

### Result:

``````10
20
5
Array: 10 20 5
``````

2

2

2

2

2

2

2

2

2

2

2

2

2

2

2