Vector vs static array

I was watching a lecture on vectors where the cab problem was solved by using the concepts of pairs and vector. I tried to solve the same question using a normal (static) array and the program was working fine. I wanted to know then why we specifically used vectors to solve that problem in the video lecture. I am attaching below the link to my program

yes you can solve any vector question using array as well

basic difference is that
Size of arrays are fixed whereas the vectors are resizable i.e they can grow and shrink as vectors are allocated on heap memory.

also many functions are associated with vectors to make it easy to use
Arrays cannot be copied or assigned directly whereas Vectors can be copied or assigned directly.
you can also return vector from function but not static array

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.