C++ Programming Tutorial 51 - Creating a Vector

Sdílet
Vložit
  • čas přidán 7. 08. 2024
  • Start your software dev career - calcur.tech/dev-fundamentals 💯 FREE Courses (100+ hours) - calcur.tech/all-in-ones
    🐍 Python Course - calcur.tech/python-courses
    ✅ Data Structures & Algorithms - calcur.tech/dsa-youtube
    ~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
    ✉️ Newsletter - calcur.tech/newsletter
    📸 Instagram - / calebcurry
    🐦 Twitter - / calebcurry
    🔗 LinkedIn - / calebcurry
    ▶️ Subscribe - calcur.tech/subscribe
    👨🏻‍🎓 Courses - www.codebreakthrough.com
    ~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
    ↪ My Amazon Store - www.amazon.com/shop/calebcurry
    🅿 Patreon - calcur.tech/patreon-calebcurry
    🅖 GitHub Sponsors - github.com/sponsors/CalebCurry
    Ⓟ Paypal - paypal.me/calcur
    🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
    🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
    📈 Buy Bitcoin - calcur.tech/crypto
    Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code "Caleb") - calcur.tech/crypto
  • Věda a technologie

Komentáře • 27

  • @Markofka
    @Markofka Před 4 lety +9

    //simple Fibonacci sequence calculator I made in like 2 minutes. The numbers however overflow at about 20 units.
    #include
    #include
    using std::cin;
    using std::cout;
    using std::endl;
    using std::vector;
    int main()
    {
    vector fib_seq = {1, 1};
    cout > units;
    for (int i = 1; i < (units - 1); i++)
    {
    fib_seq.push_back(fib_seq[i - 1] + fib_seq[i]);
    }

    for (int i = 0; i < units; i++)
    {
    cout

  • @TradeStream
    @TradeStream Před 5 lety +4

    concise summary! thanks :)

  • @BrianMarshall1
    @BrianMarshall1 Před 4 lety +3

    I only code on embedded processors with limited memory. Every library adds up. Im sure it's not an advantage on a phone or a computer, but if your microcontroller only has 16kb ram tightly managing arrays helps keep things concise and manageable.

  • @guitarhax7412
    @guitarhax7412 Před 5 lety +5

    Hell yea, referencing to outside sources because sometimes you want to encourage self research to play to our curiosity. I see you Caleb, I see you.

  • @ooo000ps8
    @ooo000ps8 Před 3 lety +1

    thanks!!

  • @ihsannazaruddin2001
    @ihsannazaruddin2001 Před 3 lety +1

    nice content,

  • @jibintmathew7048
    @jibintmathew7048 Před 2 lety

    How vectors when passed by reference can remember size inside the function?

  • @PunmasterSTP
    @PunmasterSTP Před 3 lety

    I definitely need to try this out for myself. I don’t want to just live vectariously through someone else…

  • @KevinTempelx
    @KevinTempelx Před 2 lety

    I also use visual studio code. It doesn't allow me to run c++ 11 or 17. How do I fix this?

  • @notavailabull
    @notavailabull Před 4 lety +1

    I'm really having a hard time understanding why used brackets instead of parenthesis for the parameters of the cout. What is the purpose of using the brackets and why does it work?

    • @typical_yt8525
      @typical_yt8525 Před 3 lety +1

      Not sure what you mean by the "parameters of the cout", but if you mean data[], the brackets are used to tell the index of the data. Parenthesis can't do that.

  • @lynn4381
    @lynn4381 Před 4 lety +2

    Here is the link if anyone needs : www.geeksforgeeks.org/vector-in-cpp-stl/

  • @beansm152
    @beansm152 Před 3 lety +1

    what if i have 1283 elements in the array which equal different numbers for e.g:
    1 = 1283
    .
    .
    1283=1681.067

    • @PunmasterSTP
      @PunmasterSTP Před 3 lety

      That should work as long as the array is big enough and of the right data type, right?

  • @crimsonking3873
    @crimsonking3873 Před 2 lety

    Im filling an empty array with information from another array with a for loop but im getting an error since there isnt enough allocated memory in the empty array for it to hold all the information. how do i get an empty array to hold all the information?

  • @glennpicket1066
    @glennpicket1066 Před rokem

    what is Std:: ?

  • @sirskylight7901
    @sirskylight7901 Před 4 lety

    I think out of all the times you had to use c++11, I only had to use it once. I’m not sure if the fact I’m using a PC makes any difference.

    • @natecallon9755
      @natecallon9755 Před 4 lety

      same, I haven't had to use it once and had no errors

    • @chandreshsharma6066
      @chandreshsharma6066 Před 4 lety +3

      @@natecallon9755
      The statement vector is a part of C++ 11 is incorrect.
      vector is a part of the original C++ STL introduced in 1998.
      The intializer list, i.e. the part ' = { 1, 2, 3}' is introduced since C++ 11.
      If you create the vector without using the initializer list, say
      std::vector v; it compiles fine. You can add values using v.push_back().

  • @forhadrh
    @forhadrh Před 3 lety +1

    💘💘

  • @aravinthsrisivasritharan4098

    when i use dev c++, it wont let me type it in the terminal.

    • @daverussell4052
      @daverussell4052 Před 3 lety +1

      you can choose the version off the compiler in devc++ acctually

  • @ehsansayeqal2319
    @ehsansayeqal2319 Před rokem

    I am not sure why I cannot learn from your videos.