Answer the question
In order to leave comments, you need to log in
How to make an array if you don't know its size c++?
The task is to calculate all the values of the function y with x from n to n2, in order to then collect it all into an array and find out which of the elements is the maximum. And so, a question:
1. How to create an array if you do not know its length?
2. How to calculate the maximum element from this?
the first question worries me more, I searched in Google, I did not find answers there
Answer the question
In order to leave comments, you need to log in
A vector in C++
is a replacement for a standard dynamic array, for which memory is allocated manually using the new operator.
The language developers recommend using vector instead of manually allocating memory for an array. This avoids memory leaks and makes the programmer's job easier.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question