Buckys C++ Programming Tutorials – 17 – if / else Statement



Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –

You may also like...

50 Responses

  1. Nemesi says:

    pretty old huh?

  2. lol says:

    I am 17.8 years old and I find it offensive

  3. the Fridge says:

    why is this in a bad meets evil playlist??

  4. abdul saboor says:

    Probably you run an old house and kind of offended from old people

  5. I'm 179 bitch, come at me

  6. Allan Kamoga says:

    well understood….. the simplest tutorial

  7. Sasha DD says:

    You could type in a cin command

  8. Piple Klo says:

    int main(){

    int age;
    int ageVal = 18;

    cout << "Enter your age!" << endl;
    cin >> age;

    if(age >= ageVal){

    if(age >= 100){
    cout << "Don't you think you're a bit old for this?" << endl;
    }
    else{
    cout << "Welcome to PornHub!" << endl;
    }
    }
    else{
    cout << "Sorry buddy you have to leave :(";
    }

    return 0;

    }

  9. Yeet Boy says:

    Buckys spelling> my spelling

  10. "if the user is over 60"

  11. Caterpillar says:

    I just made something really simple with if/else statement

    I'm happy to see myself progressing…

    #include <iostream>

    using namespace std;

    int main()
    {
    int x;

    cout << " Enter a number here, it must be bigger than 10. " << endl;

    cin >>x;
    if(x<10)

    { cout << "Sorry, this number is too small. " << endl;
    }

    else
    {
    cout << "This number is big enough. " << endl;
    }

    return 0;
    }

  12. 59 year olds be like, :')

  13. Krish Sabori says:

    My English is so bad

  14. Krish Sabori says:

    How we can make if else statements to show vowel and consonant letters

  15. Connor Lynch says:

    Can some one please tell me how to fix my calculator
    #include "iostream"

    using namespace std;

    int main()
    {
    int a;
    int b;
    int result;
    int sign;

    cout << "Please enter a number. n";
    cin >> a;

    cout << "Please enter another number. n";
    cin >> b;

    cout << "Please enter a comparison operator.n1 = +n2 = -n3 = * n4 = /n";

    cin >> sign;
    if (sign = 1) {
    result = a + b;
    }
    else {
    if (sign = 2) {
    result = a – b;
    }
    else {
    if (sign = 3) {
    result = a * b;
    }
    else {
    if (sign = 4) {
    result = a / b;
    }
    }

    }
    }cout << "the result of those numbers is " << result << endl;
    system("pause");
    return 0;
    }

  16. Fuck even youtube is telling me to get a job.

  17. G Dragon says:

    thanks sir.. now i know =)

  18. Sadia Ahmed says:

    hey why we are not using cin here? when we exactly use cin?

  19. are you still alive?

  20. SID M says:

    Watermelon.exe

  21. Thank You sooo much Buckyy These tutorials helped me secure 100 in C++ programming. Thank you!!!..

  22. You're hilarious Bucky and you sound like JMSN

  23. Dope DoReMi says:

    Wow this helped alot, I was confused with these at first but not anymore. Thanks bro

  24. thanx, buckys u give lot information about c++ , but i don't understand what constructor is ?

  25. i'm 178.5 and i am alive so that i can shake up 2 parallel melon with my banana XD!

  26. You're 30 years old by now.

  27. #include <iostream>
    using namespace std;

    int main(){
    int x;
    int y;
    cout << "Please Enter your input below"<<endl<<endl;
    cout << "Enter the first no : ";
    cin >> x;
    cout << "nn";
    cout<< "Enter the second no : ";
    cin >> y;
    cout << "nn";

    if (x > y){
    cout << "Your first no is bigger"<<endl;

    }
    else if (x < y){

    cout << "Your second no is bigger"<<endl;
    }
    else if (x = y){
    cout << "You have entered two equal numbers n";
    }
    else{
    return 0;
    }
    cout << "Thank you for using our comparing system"<<endl;

    }

  28. Anthony Owen says:

    Technically there is a maximum nesting depth of 256 (including the function).

  29. : ) :great video!! , mechanical engeeniring student (having hard time with the C) :DDD

  30. #include <iostream>

    using namespace std;

    int age;

    int main()
    {
    cout << "Enter your age, please." << endl;
    cin >> age;

    if(age < 18)
    {
    cout << endl << "Hi you child!" << endl;
    }else if(age <= 40 && age >= 18)
    {
    cout << endl << "Wow you are a old boyyy… :)" << endl;
    }else if(age >=41 && age <= 150)
    {
    cout << endl << "Hello granpa" << endl;
    }else
    {
    cout << endl << "GG!" << endl;
    }

    return 0;
    }

  31. you didn't teach us else if statement.

  32. #include <iostream>
    using namespace std;

    int main()
    {
    int age;
    cin >> age;

    if (age >60){
    cout<<"Damn u old" <<endl;
    }
    else if (age >30){
    cout <<"Damn u middle aged"<<endl;
    }
    else if (age <= 0){
    cout << "Damn u… er wait what?!" <<endl;
    }
    else {
    cout <<"Damn u young" <<endl;
    }
    return 0;
    }

  33. tyler g says:

    You should have put a trigger warning before talking about nesting logic like that, some of us design things you know!

  34. // #My_if_Statement:.

    if (age<18||age>13) {
    cout << "Time to get high on weedn";
    }

  35. Braden Best says:

    Would've been a perfect opportunity to introduce the && operator.

    Also, just because you can nest if blocks, doesn't mean you should. Unnecessary nesting leads to unnecessary complexity. Use functions instead.

    if(someCondition)
    functionForThatCase([necessary values]);

    else
    someOtherFunction([etc])

  36. Pete M says:

    what about else if statement

  37. somewhere yoda is looking at this and thinking "bitch please".

  38. the only thing i hate about learning from videos is that i can't directly ask you why my program isn't working and show you my screen.

  39. lim yonghun says:

    i have a qns, if i put if else statement under if else statement is it possible? e.g
    if ( year ==1 )
    {
    if (category == 1)
    {
    printf("ur great")
    }
    else if(category == 2)
    {
    printf("ur cool")
    }
    }
    else if …….
    need help ASAP thanks

  40. Dehar Gaming says:

    i teach more from you than from my teacher

  41. Blonde Zack says:

    #include <iostream>
    #include <string>

    using namespace std;

    int main()
    {
    string create;
    string login;
    string pass;
    string pass2;
    string make;
    string name;
    string name2;
    string email;

    cout << "n========WELCOME========n========BACK===========n========M8=============n" << endl;

    cout << "You don't have an account,Please Enter the Command (/create) to make one" << endl;
    cin >> create;

    if (create=="/create")
    {
    cout << "Enter your username :";
    cin >> name;
    cout << "Enter your Email :";
    cin >> email;
    cout << "Enter your password :";
    cin >> pass;
    cout << "" << endl;
    cout << "Your account has been made successfully!nnPlease enter the Command (/login) to Login to your accountn";

    cin >> login;
    if (login=="/login")
    {
    cout << "Username :";
    cin >> name2;
    cout << "Password :";
    cin >> pass2;

    if (pass2==pass) {cout << "nWELCOME BACK " << name << "!" << endl;}

    else {cout << "The name or the password that you entered are Incorrent!" << endl;}

    }
    else {cout << "nSorry,The only command available at the momment is (/login)n";}
    }
    else {cout << "Sorry,The only command available at the momment is (/create)";}
    return 0;
    }

  42. KidRaph says:

    Now I`m gonna copy this and send it to Microsoft lmaooo

  43. محمد says:

    do you really need the extra curly brackets before and after else?

  44. Bucky: "Why are you still alive?" I know its harsh but im just trying to get the point
    Bucky:C'mon guys lets face it, if you are 178 years old, you should be dead. xD Bucky XD

  45. StickMan1316 says:

    Here is what I came up with on my own after your if and else statement

    #include <iostream>
    using namespace std;
    int main ()
    {
    int x,y,z;

    cout << "Enter number n";
    cin >> x;
    cout << "Enter second number n";
    cin >> y;
    cout << x+y;

    z= x+y;

    if (z==10)
    {
    cout << " you are correctn";
    }
    else
    {
    cout << " you are Wrongn";
    }
    system("pause");
    }

  46. Nik Losi says:

    I'm 178 years old and I find this offensive.