C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++

What are vectors in C++?

11th Apr 2021, 10:36 AM
Isuru Jinasena
9 Answers
+ 5
Vectors are like arrays, but they can change in size. Also there are some advanced methods of vectors, such as empty (whether the vector is empty), erase (clear the vector), insert (insert element at specified position (next elements are shifted), push_back, (add element to the end) pop_back (delete the last element), swap (swap contents of two vectors), etc. Reference for it: http://www.cplusplus.com/reference/vector/
11th Apr 2021, 10:59 AM
#0009e7 [get]
#0009e7 [get] - avatar
12th Apr 2021, 3:09 PM
R.P.
R.P. - avatar
+ 2
Vectors are a part of Standard template library(STL). Vector is a sequence container which resize automatically when element insert or remove. It's store elements in contiguous memory locations. If you want to use vector in c++ then you have to add #include <vector> header file in code. Declares a vector of integers std:: vector<int> v;
28th Jan 2022, 4:28 PM
Mahendra Chaudhari
Mahendra Chaudhari - avatar
+ 1
Hello dear Jinasena Vectors are widely used in artificial intelligence and are a kind of dynamic memory that doubles in length if its memory is full. I hope you understand.
8th Dec 2021, 8:19 AM
Matin Nouri
Matin Nouri - avatar
+ 1
#include <iostream> using namespace std; void calutale equation on result ( float a, float b, float c, float d, float x ); void max result ( float sp1, float sp2, float sp3 ); main() { char sp; calculate equation result\( 2, 3, 4, 5, 10 ); do cout<<"\n do you to enter more data (y for yes n for no) : " ; cin>> sp; if (sp=='y' || sp=='y') calulate equation on result (6, 7, 8, 9, 11 ); else break; } while ( sp=='y' || sp=='y' ) } void calulate equation on result ( float a, float b, float c, float d, float x) { float sp1, float sp2, float sp3; sp1= x+b/ (3*a); sp2=(3*a*c-(b*b)) / ( 3* (a*a)); sp3=( 2*( b*b*b)-9* (a+b+c)+27* (a*a) *d) / cout<<" spot 1: "<< sp1 <<endl; cout<<" spot 2: "<< sp2 <<endl; cout<<" spot 3: "<< sp3 <<endl; max result ( sp1, sp2, sp3 ); // function call } void max result ( float sp1, float sp2, float sp3 ) { if (sp1 > sp 2 && sp1 > sp3 ) cout <<"\ spot 1 result is maxium"; else if ( sp2> sp1 && sp2 > sp3) cout <<"\ spot 2 result is maxium"; else cout <<"\ spot 3 result
10th Jun 2022, 7:27 PM
Ali Hamza
0
I don't know vector
26th Aug 2021, 6:42 AM
Kaung Set Min Soe
0
Hy hlo anyone slove the errors and tell me about
10th Jun 2022, 7:27 PM
Ali Hamza
0
Think-cell, C++, 90-130k eur/year, relocation to Berlin or remote work (not from Belarus/Russia) A German company Think-cell is looking for C++ developers of any level, even students and with no experience. The Company is developing a multifunctional tool for PowerPoint and this product is being sold very well 🙂 Everything is written in C++ (stl, Boost, OpenCV, OpenGL), the team is small and flat, tasks can be from any part of the product. Requirements for candidates: - good knowledge of C++ - good knowledge of algorithms - spoken English or German (B2 or higher) Salary brackets: 90-130k eur/year Terms: - payment for the completed test assignment ($1000) regardless of the hiring decision - remote work (not from Belarus/Russia) or relocation to Berlin with all assistance - very calm pace of work, work-life balance More about the vacancy (You do not need to apply via the site): https://www.think-cell.com/en/career/jobs/development.html CV and questions tg: @adnazarenko
2nd Feb 2023, 7:29 PM
Alexander
- 1
Kaung Set Min Soe, 1. Read the answers. 2. Please, answer questions like this only if you know the answer and its meaning is at least somewhat different from what others wrote in their answers (if you are not the first to answer), otherwise your answer is most likely to be considered as spam (either not an actual answer or repeating the same answer). Exceptions are when a question is (or a duscussion in answers has moved to) open-ended (examples of such topics are personal experience, bugs (in computing terms), complaint). If you have the same question or relate to a problem described in it, then upvoting that question (and answers that helped you with it if such exist) is enough. You can also press the star at the bottom left of the question if it is not highlighted already to receive notifications when someone answers, so that you can read them before you answer yourself this question again.
30th Aug 2021, 6:05 AM
#0009e7 [get]
#0009e7 [get] - avatar