Vectors in C++

Поділитися
Вставка
  • Опубліковано 17 гру 2024

КОМЕНТАРІ •

  • @stokes111111
    @stokes111111 10 років тому +42

    youre really amazing and you've helped me more than my professors and most books..

  • @ShuyanStoryTeller
    @ShuyanStoryTeller 7 років тому +6

    The video is very clear to explain and demonstrate vector. Thank you for your teaching. I can understand your lectures. but at the university, I often feel lost in class.

  • @ReelLearning
    @ReelLearning  13 років тому +5

    @JzBosco Very similar to an array, but a vector can dynamically grow and shrink. Behind the scenes a vector is just an array - if we need more space, a new array is created, the old array is deleted and the new array is referenced. I don't have a particular book that I would recommend to go along my videos, but there are several really good C++, Intro Programming/Problem Solving and Data Structures books out there... Stanford's CS106B is a good Data Structures course using C++.

  • @sonizard
    @sonizard 11 років тому +2

    Finally get vectors. In all articles and websites I read about them, no one put them in a real world application to help me visualise :O Thanks! :D

  • @bluemoon0946
    @bluemoon0946 10 років тому +101

    if you sir were my teacher at university i would've completely learned C++ in a weak.and thank you so much for these great videos.

    • @logan_makes_games
      @logan_makes_games 9 років тому +66

      bluemoon0946 You hopefully would have learned how to spell also.

    • @bluemoon0946
      @bluemoon0946 9 років тому +18

      Christopher Ruf maybe! and english is not my mothertounge.so yeah i may make some mistakes when it come to writing!!!!!

    • @bluemoon0946
      @bluemoon0946 9 років тому +1

      ***** as i said before ENGLISH IS NOT MY FIRST LANGUAGE ,by "COMPLETLY LEARNED IN A WEAK" i didnt mean that I would've literaly learned c++ in a weak.(as a student of software engineering major) all i was saying was that if he was our professor, it could've been easier for me to learn faster. bcz his teaching method is way better than the professors at my university.
      AND NO I...AM...NOT...CRAZY!!! :)

    • @bluemoon0946
      @bluemoon0946 9 років тому

      ***** NO PROBLEM. :)

    • @danielday3162
      @danielday3162 9 років тому +7

      +Christopher “Logan” Ruf you are a douchebag.

  • @ReelLearning
    @ReelLearning  13 років тому +5

    @JzBosco I have about 15 or so data structures books and that is my favorite. I didn't know Stanford provided the first 13 chapters on the 106B site. The examples and explanations provided by Roberts are fantastic. Some people complain about the quality of the printed edition since it appears photocopied from an original source, but the content is gold.

  • @super4543
    @super4543 6 років тому +2

    Sir thank you so much for explaining what a vector is and how it works 4:39

  • @roycrxtw
    @roycrxtw 2 роки тому +1

    Clear and simple, thank you.

  • @shashwatpandey3556
    @shashwatpandey3556 4 роки тому

    You, sir, did a real classy job, I would've gone nuts over this topic...
    Thank you very much...

  • @cabreram.4734
    @cabreram.4734 5 років тому +6

    It's so crystal clear! thank you so much!!
    EDIT: is there anything I should watch out for here since newer versions of c++ have gone out? Thanks for answering..

  • @nijatqazi288
    @nijatqazi288 4 роки тому +1

    its for real ... real learning, I never comment on YouTobe videos but this one really thought me something . thanks keep it up bro.

  • @dewannazmulislam9004
    @dewannazmulislam9004 3 роки тому

    tnx for the video....student from a remote part of Bangladesh

  • @souljarohill8795
    @souljarohill8795 2 роки тому

    All good. Learned a lot from this vid. Gonna practice vectors tommorow.

  • @vujkopopovic3713
    @vujkopopovic3713 3 роки тому

    Best explanation on youtube! Thank you very much. :)

  • @waverly2468
    @waverly2468 2 роки тому

    Thanks, I'm learning about ray tracing and many of the sample programs are in C++.

  • @ReelLearning
    @ReelLearning  13 років тому

    @JzBosco I just checked out the course reader and they have updated it for C++. It also looks like they will be publishing a new version of the book using C++ in the next year or so.

  • @indanil9953
    @indanil9953 3 роки тому

    best teacher are hard to find like you 😍

  • @jeevesbarton
    @jeevesbarton 11 років тому +1

    Absolutely wonderfully explained! Great job! Thanks!

  • @fezzroni1987
    @fezzroni1987 11 років тому +1

    Thank you so much. Much needed. Very easy to follow along.

  • @uniquehandle767
    @uniquehandle767 12 років тому

    great tutorial -- hoping more people who need to figure out c++ can discover ReelLearning

  • @lenisac6794
    @lenisac6794 11 років тому +2

    Excellent videos. Thanks.

  • @lucasjc7567
    @lucasjc7567 4 роки тому

    can you specify the size of the vector with a variable, like pos(as in postition)? Like this: vectorv(pos).

  • @ReelLearning
    @ReelLearning  13 років тому +1

    @JzBosco Bruce Eckel makes the older editions of his books (Thinking in C++, Thinking in Java etc) free. The cplusplus website with it's C++ language tutorial is really great.

  • @CuriousAndCuriouser1865
    @CuriousAndCuriouser1865 3 роки тому +5

    What's the point of vectors when arrays already exist, even dynamic arrays?

    • @w1atrak1ng
      @w1atrak1ng 3 роки тому +1

      Vectors are more dynamic

    • @ReinAbrera
      @ReinAbrera 3 роки тому

      Some IDEs doesn't support dynamic arrays.

  • @janedoe9596
    @janedoe9596 5 років тому

    If you really wanted to throw employees and disks together you could use a union. In case anybody was wondering:) love the videos!

  • @sa25078
    @sa25078 4 роки тому

    Video was short ,sweet &simple .but i would recommend more detailing in coding tips

  • @Zerpentile93
    @Zerpentile93 11 років тому

    I am a begnner myself. But I guess that it would be worth that I mension something important I read about vectors when it comes to efficiency. vectors are relatively fast at accessing any element in the list, it does not matter where whether it's the front, end or in the middle of the vector. It is also good at removing and adding elements at the end of the array.
    However, it is slower and worse when it comes to removing and adding elements in the middle or any random index in the array.

  • @mastermatt6090
    @mastermatt6090 4 роки тому

    nicely explained thank you very much

  • @inspace2360
    @inspace2360 4 роки тому

    Nice vedios almost everything about vector that is used generally is explained in this vedio, but you left one important function i.e. pop_back() ; function present in vector class. At last great explanation.

  • @mralecjuan
    @mralecjuan 10 років тому

    How is the push back operation helpful? it's just as easy to replace v(3) with v(4) and add the new value.

  • @dt8129
    @dt8129 6 років тому +2

    Plzz make video on scalar

  • @beansm152
    @beansm152 3 роки тому

    Hello I need some help. So i need to do a similar thing as this as I am working out value at risk but I have been given 1284 series of prices to load data which I have done. so would I do Vector data(1284)? the series dont go from 1-1284 that is just the size, the actual numbers are different so for e.g:
    1 = 1283
    2= 1794
    3= 1766
    .
    .
    1284= 1681.067

  • @onlyliveones87
    @onlyliveones87 11 років тому

    Nice explanation. Keep going....

  • @alexandergolovinov9842
    @alexandergolovinov9842 5 років тому

    Thank you for the video.
    Better approach however to use iterator over the vectors. First you need to assign iterator to a vector vector::iterator it;
    and then use it for going through the vector for(it = v.begin(); it != v.end(); it++) {} It is preferred, because in comparison with Java we do not know the indexes of elements in the vector at run time. Basically it is more dynamic :) CheersPlusPlus

  • @Gardenerbyday
    @Gardenerbyday 9 років тому +2

    this saved me!! understanding by 10:09 for what I need!!

  • @joeyodr
    @joeyodr 7 років тому +1

    Really well explained, thanks!

  • @m.alaiady3627
    @m.alaiady3627 4 роки тому

    there are many question, in c++ when you try to get the first character you must type vec[0][0] but why double dimension applied

  • @Gaer56
    @Gaer56 7 років тому

    What if i wanna change value? But keep the name? Should i keep vector and then put map on it , or use "map [3] = 1" ?

  • @averageAmerican98
    @averageAmerican98 6 років тому

    How can you attach the contents of a vector into a string?
    Here's a pseudocode: "cout

  • @ivanivanovic5792
    @ivanivanovic5792 5 років тому

    what is difference between v[0] and v.at(0); ?? is v.at(0){return v[0]} anything like that?

  • @vindennl48
    @vindennl48 9 років тому

    How the heck do you have the code print to a console in the program?? My code prints to a cmd window outside of Visual Studio and for the life of me, I can't figure out how to switch it..

    • @pietroehrlich6907
      @pietroehrlich6907 8 років тому

      It's basically the same thing, he just has his console inside the compilator but that is because eclipse (the program he's using) is made that way.
      Btw if you are using visual studio you are probably programming in visual c++ which has some small differences with the one he is using.

    • @vindennl48
      @vindennl48 8 років тому

      Looking back over a year ago posting now, yeah I'm pretty sure It is eclipse as well. And yes, I use visual c++ but use netbeans for java stuff. It's still annoying with visual studio but the benefits outweigh the console issue so it is what it is.

    • @Taz432166
      @Taz432166 8 років тому

      You can print to the output window in visual studio, you just need to use OutputDebugString() msdn.microsoft.com/en-us/library/aa363362(VS.85).aspx

  • @TheReckonerrr
    @TheReckonerrr 10 років тому +18

    Can you have a vector of vectors?

    • @pekkak.1411
      @pekkak.1411 10 років тому +10

      Yes. For example two dimensional vectors are created doing that: vector arr2dim;

    • @jacksonjoestar5035
      @jacksonjoestar5035 7 років тому +12

      You sir are out of your vector.

    • @Idan-tc5rt
      @Idan-tc5rt 7 років тому +1

      Only if you include the Vectorception library.

    • @crateer
      @crateer 5 років тому

      @@Idan-tc5rt not really, you could use pointers

  • @sdasshuva
    @sdasshuva 9 років тому

    thank you very much sir, your tutorials are awesome...

  • @tlhomotsemoteme2423
    @tlhomotsemoteme2423 6 років тому

    Thank you for making my life easy.

    • @aloktiwari2732
      @aloktiwari2732 5 років тому

      U made your life tough yourself.U should have helped Fugaku with the coup de tat.

  • @persiansayed
    @persiansayed 8 років тому

    Thanks for such great demonstration. Understood the basics! :) Keep up the good work.

  • @msh1233
    @msh1233 8 років тому

    Thank you . You are a great teacher.

  • @justynatokarska9186
    @justynatokarska9186 7 років тому

    how can I implement the function "insert" for vectors?

  • @azaruto
    @azaruto 10 років тому +5

    So vector is basically advanced array?

    • @IllIlIIllIlIl
      @IllIlIIllIlIl 8 років тому +7

      +azaruto It is in every way a superior array. Never use standard dynamic arrays unless you have a good reason to.

    • @elizabethstevenson9707
      @elizabethstevenson9707 7 років тому +1

      Don't you use them to initialize vectors?

    • @PerchEagle
      @PerchEagle 5 років тому

      that what I thought about.. what's special about vectors then ?

  • @bijudhanapalan2982
    @bijudhanapalan2982 4 роки тому

    wonderful tutorials, thank you

  • @shubhamshinde5643
    @shubhamshinde5643 4 роки тому +1

    I know everything already i was here to know that :- if memory location first element of array is memory location store in name of array than what is store in vector variable name???????

  • @vx3666
    @vx3666 8 років тому

    So...what is the difference between this (vector) and an array?

  • @shankysays
    @shankysays 7 років тому

    is it passed by value or reference because array are passed by value. shouldnt it be same ?

  • @adammarsono8908
    @adammarsono8908 7 років тому

    How do you handle the last error?

  • @Peace-hi8hu
    @Peace-hi8hu 5 років тому

    I finally understand vectors!

  • @TomTheSiberianHusky
    @TomTheSiberianHusky 4 роки тому +1

    at 14:40 I was screaming "YOU FORGOT THE SEMICOLON! DON'T BUILD! WAITTT!!" and he builds and is like "Uh what...Oh, semicolon..."

  • @dwipshekharmondal3877
    @dwipshekharmondal3877 8 років тому

    how do i make an array in which the values are inputed by the user and which can carry as many values as it can and the values can be modified and calculated(like sum,division multiply etc). or it cant be made ?? someone plz answer.
    lang : python, c++

    • @intercointerface212
      @intercointerface212 8 років тому

      Well which laungage do you want it in?

    • @dwipshekharmondal3877
      @dwipshekharmondal3877 8 років тому

      python or c++ or both.

    • @intercointerface212
      @intercointerface212 8 років тому

      deep mondal Well python it's easy it's just
      t = []
      while True:
      a = input(": ")
      if a == "q":
      break
      else:
      t.append(a)
      print(t)
      but in C++ you'll have to make a vector and instead of using t.append() like in python you'll have to use t.push_back().

    • @dwipshekharmondal3877
      @dwipshekharmondal3877 8 років тому

      InterCo - interface212 thanks man for the solution. :) this think was bugging me for days.

    • @intercointerface212
      @intercointerface212 8 років тому

      deep mondal Did you not try any of the forums? UA-cam REALLY isn't the place to ask this stuff as all the guys who know what they're doing use proper forums. If you got any other questions you can always ask me on discord if you want by the way.

  • @akshatrb
    @akshatrb 4 роки тому

    Loved it!

  • @pratyushbajaj5231
    @pratyushbajaj5231 4 роки тому

    which ide is this?

  • @zidrexandag06
    @zidrexandag06 8 років тому +3

    whatis the difference between vector and array? they look the same

    • @danielday3162
      @danielday3162 7 років тому +8

      Vectors are a dynamically allocated array. Just a tad bit better than a regular array.

    • @HermanWillems
      @HermanWillems 6 років тому

      Can you use vectors in Deterministic code for devices in hospitals where a memory issue can kill people? We can use a predefined array ;)

  • @abugslife2461
    @abugslife2461 4 роки тому

    Thank you! much appreciated 😊😅

  • @YasirBarznar
    @YasirBarznar 5 років тому

    write a C++ program to initialize two vectors that are found in the following sets: A={1,5,7,3,-8,-4,9,6,-7,2} and B={5,8,4,2,5,3,7,-7,-9,2}
    can you solve this for me please ?

  • @Xacksar
    @Xacksar 3 роки тому

    I don't understand how b is referencing the index of v.

  • @modoulaminceesay9211
    @modoulaminceesay9211 3 роки тому

    Thanks helped me a lot

  • @edilaver4756
    @edilaver4756 4 роки тому

    4:57 nice voice crack bro

  • @rajshah7390
    @rajshah7390 4 роки тому

    Thanks this was helpful!

  • @Xanpakuto
    @Xanpakuto 10 років тому

    Thank you very much sir.

  • @alogedroberomous5825
    @alogedroberomous5825 11 років тому +1

    you can't just use int i, you have to use unsigned int i

    • @ChristopherJones16
      @ChristopherJones16 8 років тому

      Hi why is that so? Just wondering about size_t

    • @The2bdkid
      @The2bdkid 8 років тому +1

      What if your vector has more elements than the largest int? It wouldn't compute. The BEST way to do this is through an iterator, but that was beyond the scope of the video.

    • @The2bdkid
      @The2bdkid 8 років тому

      size_t represents "maximum size of a theoretically possible object of any type" and is implementation-defined. It's mostly used when you don't know how many of something you'll have, such as elements in a vector.

    • @AlexandruCatalin
      @AlexandruCatalin 7 років тому

      You can use it as signed too. But if you want to be pedantic you should use your own typedef that account for architecture difference.

  • @ruchapandya9338
    @ruchapandya9338 7 років тому

    can u plz tell which ide u r using

  • @whiteknight8059
    @whiteknight8059 7 років тому

    A great video it was

  • @teeman9266
    @teeman9266 11 років тому

    Touchscreen?

  • @ShayConstantine
    @ShayConstantine 7 років тому

    Are you using an IDE?

    • @SoyDelSouth
      @SoyDelSouth 7 років тому

      AkshaySrinivasan he's using eclipse

  • @okmanek69
    @okmanek69 5 років тому

    Kids, don't pass vectors to functions by value as he did. And use const whenever appropriate.

  • @camoogoo
    @camoogoo 4 роки тому

    If you need a double to store your rainfall you are very wet indeed.

  • @mudithead
    @mudithead 11 років тому

    Nice.. Is there a way I can store the first 3 values of this standard vector into a Vec3f, which is basically x, y, z..
    So in just one line(with a 'for' loop) I wanna store first 3 values into a single Vec3f type vector.. something like---- in for loop--- Vec3f startPoint = vector homeVector..
    Please help

  • @predragvuckovic4183
    @predragvuckovic4183 10 років тому

    Thank you verry much!

  • @Rita-og7cy
    @Rita-og7cy 4 роки тому

    thank you

  • @isaac-chemist
    @isaac-chemist 4 роки тому

    at 1.5 playback rate is perfect

  • @mehershrishtinigam5449
    @mehershrishtinigam5449 4 роки тому

    thanks

  • @СеймурАйвазов-в1л
    @СеймурАйвазов-в1л 8 років тому

    Thanks for video, it was very useful
    By the way, we could also use in that loop cout

  • @shubhangb3267
    @shubhangb3267 8 років тому

    Thank you so much :)

    • @josebapujee3077
      @josebapujee3077 8 років тому

      ɷɷɷ Heeyy Friends I Have Founddddd Working Online Hacck visitttt : - t.co/q8S0s6FHf2

  • @m.alaiady3627
    @m.alaiady3627 4 роки тому

    I think I should go and learn math again !

  • @vibol03
    @vibol03 12 років тому

    how the hell do you write like that with a mouse?

  • @jessicaa4429
    @jessicaa4429 4 роки тому

    I thought elements began at index zero.

  • @didierleprince6106
    @didierleprince6106 5 років тому

    Bien

  • @KassandraTovar
    @KassandraTovar 3 роки тому

    why doesn't my professor explain stuff like this..

  • @jakejoyner7419
    @jakejoyner7419 Рік тому +1

    everything is perfect expect for the fact that you're not Indian

  • @jacksonjoestar5035
    @jacksonjoestar5035 7 років тому

    Compared to this guy, I'm out of my Vector. . . . .

  • @aminehanini1355
    @aminehanini1355 4 роки тому

    good but tooo long

  • @crateer
    @crateer 5 років тому +8

    Thanks for not being Indian.

  • @johnvolks1225
    @johnvolks1225 5 років тому

    I don't believe people who write using their mouse cursor

  • @kaiwalyaaney6119
    @kaiwalyaaney6119 4 роки тому

    What is the difference between vector and array?