Buckys C++ Programming Tutorials – 34 – Using Arrays in Calculations

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

49 responses to “Buckys C++ Programming Tutorials – 34 – Using Arrays in Calculations”

  1. Safir Semon Avatar

    Hey Bucky, is Tuna your favourite fish ?

  2. Tushar Patel Avatar

    Hey instead u could just do like this

    for (tuna[x=0];tuna[x<5];tuna[x++]){

    }

  3. George Sabu Avatar

    I made this "number table finder" program after watching this vid , check it out

    #include <iostream>
    using namespace std;int main()
    {
        int shit[10];
        int sum =0;
        int y=0;

        cout <<"Enter a number you want to find it's table: " << endl;
        cin  >> y;

        cout <<"nnHere is "<< y<<"'s table :"<< endl;  
    for(int x=1; x <=10; x++){
            cout << y <<" x "<< x <<" = ";
            for(int x = 0;x <10;x++)
                shit[x]= y;
                sum += shit[x];        cout << sum << endl;   }
    }

  4. sanjay bramhane Avatar

    Hi bukky, i want to know how do we read, convert, print the binary stream of word of 1024 word with each word with 12 bits. The value overlapping in the different words. Can you pl explain or send a link for this

  5. Niggy McNig Avatar

    Alright this is what bothers me about learning programming, at least my experience with it. I am now on tutorial 34 and when he was about to create the for loop on how to calculate it, i had no clue, none, on how to do it myself. I never figure out the problems my self i always need him to explain it and then in memory i can copy it and do it on my own. My fear is that i will never be able to figure out solutions like this on my own and just completely fail when i am going to learn computer science this year.

  6. Jean Cuellar Avatar

    These are some of the best explanations I have been able to find on C++. Thank you so much for your videos, truly helpful.

  7. Jack Claudiu Avatar

    I'm already pausing the video, read your mind and write the code before u! 10x

  8. rhysman0001 Avatar

    Just me or do none of these have sound anymore?

  9. kiba johnson Avatar

    This gives me such a headache

  10. creativeKnowledge Mike Avatar

    so would x– mean subtract?

  11. WaseaMan Avatar

    hi guys, got a question : why if I change the x++, from the loop, to x+2 is showing me continuous numbers?
    I was expecting to add my numbers from the array 2 by 2. Like sum(0) + 0 element from array (20), then the sum with the 2nd element (76) and so on till it see there's no 6th number in the array and stop….guess i got it wrong that x++ is not the increment…which actually is…thx

  12. abass opeyemi Avatar

    what happens if you live the array open. like
    int ram=0.0;
    ram=10+rand() %(100-10+1);

    int bnuckys[ ]={ram} ?
    i am trying to make the arrays generate a random number.
    I am trying to understand how it gets the number, please help.

  13. ܔܛܔ ܔܛܔ Avatar

    Hey guys, this worked to me for learning c++ faster.Whenever you start the video, wait for Bucky to say what he want to do and try to do it before he does it in your way, i learned it very fast this way :O

  14. DevPlay Avatar

    Declaring X inside the for loop is a tiny bit confusing.. I get it now though.

  15. Ameerhun1996 Avatar

    Nice, short, clear

  16. David Muhs Avatar

    i forgot what ; does in c++ and google iisnt helping. PLEASE HALP

  17. dan blankenship Avatar

    this is how the user can select how many elements there are, and their values

    #include <iostream>
    #include <cmath>
    using namespace std;

    int main(){
    int p=0;
    int j;
    cout <<"How many numbers do you want to use? "<<endl;
    cin >> j;
    int h[j];
    cout << "input "<<j<<" integers "<<endl;
    for (int i=0; i<j; i++){
    cin >> h[i];
    p=p+h[i];
    }
    cout <<"the total is: "<<p<<endl;
    }

  18. Erick Avatar

    Can someone explain to me how the For loop runs through each array index & adds them up (maybe in a list of steps it takes?) ?

    I know Bucky covered it, but I'm just really slow & get lost lol

  19. steve122288 Avatar

    this is slightly unrelated, but i noticed when i initialize a couple things:
    int a = 4;
    int b = 5 + a + b;
    cout << b ;

    The result is 9. Aha. I just answered my own question. I think its because, = has a lower precedence over + ? Meaning variable b had been created as 0 but it had been set equal to the calculation of 5 + 4 + 0; since b was currently 0;

    I just also noticed that i cannot make a statement to modify b after i had created it. I guess any kind of modification has to be a function? It makes me ponder what then a function is. Especially since a function is a variable at the same time as it modifies other variables. Hmm.. but to give it statements like that.. u have to have parentheses.. to indicate what values to be passed into this same value? it must possess some kind of mechanics to modify values to create itself the value? lol damn.. getting myself lost here. I guess a function has to perform some logic to determine what it is equal to? .. but is ready to modify itself? hmmm… wait uhmm. i opk well wait that would mean, if its a function, the data would get created temporarily? It has memory set asside for itself.. by default it is 0 or null or sumthing.. and when we run the function.. we are setting something equal to it.. so we are modifying the memory slot.. then returning its value to some other memory slot that is permanent? does the function memory get set equal to 0 after that orr? unless we are stil in the function. Wiat so doesnt that mean a program is a big function that is still running? And that when we exit the program, we are then setting the memory of the program back to 0.. or some sort? Or i suppose we are.. unreserving the memory? Instead of setting it back to 0, the memory becomes unreserved so it can be overwritten?

  20. Yanlu Jiang Avatar

    Tuna is buckys girlfriend !!!!!

  21. Batman Avatar

    This is not working help!!

    #include <iostream>
    #include <string>

    using namespace std;

    int main() {

    int dece;
    cout<<"choose 1 for typical or 2 for pro maybe"<<endl;
    cin>>dece;

    switch(dece){
    case 1:
    cout<<"the typical way"<<endl;
    int lag[5]={34,234,4235,4523,3};
    int sum;
    sum = lag[2]+lag [4];
    cout<<sum<<endl;
    break;

    case 2: cout<<"the pro way"<<endl

    int lag[5]={34,234,4235,4523,3};
    int sum=0;

    for (int nub=0;nub<=4;nub++) {
    sum+= lag[nub];
    cout<<sum<<endl;
    }
    break;

    }}

  22. Samith Karnekar Avatar

    after i am done wih the code, when i run it just comes process returned , press any key to cont HOW DO I SOLVE THAT PLZ HELP

  23. adka datka Avatar

    I guess we could say that Bucky got sum ( ͡° ͜ʖ ͡°)

  24. shreeram venkatesan Avatar

    is it a must to enter
    sum=0;

  25. Jonét ジョネー Avatar

    Hmm, when I run the program, I don't get all the numbers displayed, just the sum.

  26. NerdByFate Avatar

    Instead of creating a "for" loop for this, you could simply do:
    "sum = tuna[0] + tuna[1] + tuna[2] + tuna[3] + tuna[4];"
    or, if you wish, you could add tuna[0] then print sum, add tuna[1] then print sum, add tuna[2] then print sum, add tuna[3] then print sum, and add tuna[4] then print sum.

  27. GuyB790 Avatar

    man, you really love tuna.

  28. Mr Takobana Avatar

    hey Bucky im so grateful for all the effort you making to get your knowledge across all the world,I must say im learning a lot from these videos than anythin else to do with C++,its very informative! BUT i have one complaint, :/ ,As a pig farmer i feel like fish is being given more attention right now,i mean there is a lot of favouritism going on here,do you mind using bacon for sometime instead of tuna :/ ? thank you

  29. Jdm1891 Avatar

    I made a program that gets input for number of elements and the numbers:

    #include <iostream>
    int main()
    {
        int total = 0;
        int input = 0;
        int number = 0;
        std::cout << "Enter number of Elements:";
        std::cin >> input; std::cout << std::endl;
        int IntArray[input];
        for(int x = 0; x < input; x++)
        {
            std::cout << "enter Number:";
            std::cin >> number; std::cout << std::endl;
            IntArray[x]=number;
            total+=number;
        }
        std::cout << total;
    }

    does anyone know how I could improve it?

  30. WarriorOfHonor16 Avatar

    gosh dude I can't tell you how helpful your videos are!

  31. Tran Vu Avatar

    in his program, he already has a set of inputs. what would you put if you are asking the user to input their own numbers?

  32. Yigit Yilmaz Avatar

    I actually like your tutorials but I don't understand the point is that why you never ask user to get input . For example here you could ask user to get initializer list . I think it'd be better .. 

  33. João Miguel Avatar

    why int x inside of the for() and not int tuna?

  34. Mark Black Avatar

    i am getting tired of Bucky and his tuna. XD

  35. thomasabramson100 Avatar

    can array be cin>> so user can perform various calculations

  36. Shane Harrison Avatar

    Hello, vids are great, I do have a question.  How do you add a float that gives you different outputs and you have to add those outputs into another spot

  37. MasterMapMaker Avatar

    "I'm tired of using Bucky all the time"
    I'm tired of you using food all the time, especially tuna

  38. Lansana Camara Avatar

    I tried to do it on my own before bucky revealing the more efficient way to do it.. and I got it right. The problem is, I forgot the endl; in my output, so all the numbers were bunched together and it made me think I wasnt doing it right, then proceeded to watch the video and realized I am a genius. ;D A genius that forgets to put endl, at least.

  39. William Guimont Avatar

    And if you use an variable to declare an array, you can simply use it another time

  40. William Guimont Avatar

    @aleksandar No need to, it's not a vector. When a Array is created, you choose the lenght of it, but if you want to know the size of a vector (the lenght can change by using .push_back( ) ) simply use vectorName.size( )

  41. ImSoNotSleepy Avatar

    I made it all the way here, A lot more to go through

  42. Derick R Avatar

    cout << sum << endl; needs to be within your for-loop. You have it placed outside of your loop which only prints the final sum value after the loop has completed. Hope this helps if you haven't figured it out yet.

  43. Nihilsciens Avatar

    int Tuna[5] = {20,40,99,28,19};
    int sum = 0;
    for(int x = 0 ; x < 5 ; x++){
    sum+=Tuna[x];
    }
    cout << sum << endl;

    This doesn't work for me, nothing appears on the CMD when I run it. All it says is the program returned some ridiculously high number and the execution time was 0,00001s.

    But when I add a "cout << "Hello world! << endl; before the "int Tuna[5] = …" function, the function works perfectly? How come adding a cout-function fixes everything? I want it to work like yours though?

  44. ootuskaai Avatar

    Bucky tuna tuna Bucky…..

  45. ZVC Avatar

    this is same as calculating the sum of some number , the only difference is that here we use an array and not some number inputted by users.

Leave a Reply

Your email address will not be published. Required fields are marked *