Facebook – https://www.facebook.com/TheNewBoston-464114846956315/

GitHub – https://github.com/buckyroberts

Google+ – https://plus.google.com/+BuckyRoberts

LinkedIn – https://www.linkedin.com/in/buckyroberts

reddit – https://www.reddit.com/r/thenewboston/

Support – https://www.patreon.com/thenewboston

thenewboston – https://thenewboston.com/

Twitter – https://twitter.com/bucky_roberts

Proudly WWW.PONIREVO.COM

# Buckys C++ Programming Tutorials – 8 – if Statement | Video

READ ALSO: Class 10 science video tutorials | Chemical Reaction and equations| Wahthu part 1 {VIDEO}

Bucky IS awesome

❤️❤️❤️❤️❤️❤️❤️❤️

i made a program not by your help but i felt like showing off so here it is

#include <iostream>

using namespace std;

int main ()

{

for(;;)

{

long double first_constant, second_constant, limit_completer;

long int table_limit;

table_limit = -1;

string basic_arithmetic, yes_or_no, continue_;

cout << "Which basic arithmetic do you want to do:";

cin >> basic_arithmetic;

if (basic_arithmetic == "multiply" or basic_arithmetic == "m" or basic_arithmetic == "M" or basic_arithmetic == "*" or basic_arithmetic == "x")

{

cout << "(if you input a letter i will destroy your computer)nWhat do you want to multiply:";

cin >> first_constant;

cout << "(if you input a letter i will destroy your computer)nBy:";

cin >> second_constant;

for(;;)

{

cout << "nWould you like a table [y/n](no words):";

cin >> yes_or_no;

if(yes_or_no == "y" or yes_or_no == "Y" or yes_or_no == "n" or yes_or_no == "N")

{

break;

}

if(yes_or_no != "y" and yes_or_no != "Y" and yes_or_no != "n" and yes_or_no != "N")

{

cout << "nYou have put wrong input please make sure you only used eather y or n in eather lowercase or uppercase.n";

}

}

if(yes_or_no == "y" or yes_or_no == "Y")

{

cout << "Till which number from zero:";

cin >> table_limit;

}

cout << "n" << first_constant << "x" << second_constant << "=" << first_constant * second_constant << "nn";

for (limit_completer = 0; limit_completer <= table_limit; limit_completer++)

{

cout << first_constant << "x" << limit_completer << "=" << first_constant * limit_completer << "n";

}

cout <<"Would you like to continue[y/n]:";

cin >> continue_;

if(continue_ == "n" or continue_ =="N")

{

cout << "nnThank you and goodbye user.";

break;

}

}

if (basic_arithmetic == "devide" or basic_arithmetic == "d" or basic_arithmetic == "D" or basic_arithmetic == "/" or basic_arithmetic == "÷")

{

cout << "(if you input a letter i will destroy your computer)nWhat do you want to devide:";

cin >> first_constant;

cout << "(if you input a letter i will destroy your computer)nBy:";

cin >> second_constant;

for(;;)

{

cout << "nWould you like a table [y/n](no words):";

cin >> yes_or_no;

if(yes_or_no == "y" or yes_or_no == "Y" or yes_or_no == "n" or yes_or_no == "N")

{

break;

}

if(yes_or_no != "y" and yes_or_no != "Y" and yes_or_no != "n" and yes_or_no != "N")

{

cout << "nYou have put wrong input please make sure you only used eather y or n in eather lowercase or uppercase.n";

}

}

if(yes_or_no == "y" or yes_or_no == "Y")

{

cout << "Till which number from zero:";

cin >> table_limit;

}

cout << "n" << first_constant << "÷" << second_constant << "=" << first_constant / second_constant << "nn";

for (limit_completer = 0; limit_completer <= table_limit; limit_completer++)

{

cout << first_constant << "÷" << limit_completer << "=" << first_constant / limit_completer << "n";

}

cout <<"Would you like to continue[y/n]:";

cin >> continue_;

if(continue_ == "n" or continue_ =="N")

{

cout << "nnThank you and goodbye user.";

break;

}

}

if (basic_arithmetic == "plus" or basic_arithmetic == "add" or basic_arithmetic == "addition" or basic_arithmetic == "+" or basic_arithmetic == "sum" or basic_arithmetic == "together" or basic_arithmetic == "increase" or basic_arithmetic == "up" or basic_arithmetic == "high" or basic_arithmetic == "higher")

{

cout << "(if you input a letter i will destroy your computer)nWhat do you want to add:";

cin >> first_constant;

cout << "(if you input a letter i will destroy your computer)nBy:";

cin >> second_constant;

for(;;)

{

cout << "nWould you like a table [y/n](no words):";

cin >> yes_or_no;

if(yes_or_no == "y" or yes_or_no == "Y" or yes_or_no == "n" or yes_or_no == "N")

{

break;

}

if(yes_or_no != "y" and yes_or_no != "Y" and yes_or_no != "n" and yes_or_no != "N")

{

cout << "nYou have put wrong input please make sure you only used eather y or n in eather lowercase or uppercase.n";

}

}

if(yes_or_no == "y" or yes_or_no == "Y")

{

cout << "Till which number from zero:";

cin >> table_limit;

}

cout << "n" << first_constant << "+" << second_constant << "=" << first_constant + second_constant << "nn";

for (limit_completer = 0; limit_completer <= table_limit; limit_completer++)

{

cout << first_constant << "+" << limit_completer << "=" << first_constant + limit_completer << "n";

}

cout <<"Would you like to continue[y/n]:";

cin >> continue_;

if(continue_ == "n" or continue_ =="N")

{

cout << "nnThank you and goodbye user.";

break;

}

}

if (basic_arithmetic == "minus" or basic_arithmetic == "decrease" or basic_arithmetic == "subtraction" or basic_arithmetic == "-" or basic_arithmetic == "lower" or basic_arithmetic == "down" or basic_arithmetic == "subtract")

{

cout << "(if you input a letter i will destroy your computer)nWhat do you want to subtract:";

cin >> first_constant;

cout << "(if you input a letter i will destroy your computer)nBy:";

cin >> second_constant;

for(;;)

{

cout << "nWould you like a table [y/n](no words):";

cin >> yes_or_no;

if(yes_or_no == "y" or yes_or_no == "Y" or yes_or_no == "n" or yes_or_no == "N")

{

break;

}

{

}

}

{

cout << "Till which number from zero:";

cin >> table_limit;

}

cout << "n" << first_constant << "-" << second_constant << "=" << first_constant – second_constant << "nn";

for (limit_completer = 0; limit_completer <= table_limit;

limit_completer++)

{

cout << first_constant << "-" << limit_completer << "=" << first_constant – limit_completer << "n";

}

cout <<"Would you like to continue[y/n]:";

cin >> continue_;

if(continue_ != "y" and continue_ != "Y" and continue_ != "n" and continue_ != "N")

{

cout << "Please input eather y to continue or n to stop thay can be written as either lowercase or uppercase letters."

}

if(continue_ == "n" or continue_ =="N")

{

cout << "nnThank you and goodbye user.";

break;

}

}

if(basic_arithmetic != "Multiply" and basic_arithmetic != "multiply" and basic_arithmetic != "m" and basic_arithmetic != "M" and basic_arithmetic != "*" and basic_arithmetic != "x" and basic_arithmetic != "devide" and basic_arithmetic != "Devide" and basic_arithmetic != "d" and basic_arithmetic != "D" and basic_arithmetic != "/" and basic_arithmetic != "÷" and basic_arithmetic != "plus" and basic_arithmetic != "add" and basic_arithmetic != "addition" and basic_arithmetic != "+" and basic_arithmetic != "sum" and basic_arithmetic != "together" and basic_arithmetic != "increase" and basic_arithmetic != "up" and basic_arithmetic != "high" and basic_arithmetic != "higher" and basic_arithmetic != "minus" and basic_arithmetic != "decrease" and basic_arithmetic != "subtraction" and basic_arithmetic != "-" and basic_arithmetic != "lower" and basic_arithmetic != "down" and basic_arithmetic != "subtract")

{

cout<<"nPlease do not have any uppercase letters,numbers and arithmetic equations that are not basic(addition,multiplication,subtraction,devision) or extra symbols like .(if this warning system does not tell what you did wrong that is for you to figure out)nn";

}

}

return 0;

}

just search online c++ click on the gdb website and control v this (cotrol a then control c this to copy all of this quickly)

Bucky is awesome though. No if statement required for that imo.

I made this function with the help of your tutorials 🙂

int x = 1;

int y = 2;

if (x > y) {

cout << "pizza is greasy" << endl;

}

else if (y > x) {

cout << "greasy is pizza" << endl;

}

return 0;

U saved me 4 years lmao

Thanks bucky!!

Is there any difference between >= and =>?

Aren't equal to (==) and not equal to (!=) also relational operators ?

I love you, Bucky!

This guy is boss

How are you building and running so quick?

4:05 It won't give an error. The "=" simply assigns the value that evaluates to true. Hence, if block would be executed.

TOP DOG! pretty cool huh – indeed

Thanks dudeee 🙂

bucky is AWESOME…!!!

how you run the code, how you remove * before main in heading

God bless you

the more u dive into this tutorial , the more interesting its gonna be , i would say Bucky Roberts u are awesome…

Hi, how do you make an if statement that states "Less than 10 but no less than 5"

edit: Ok, I just put in

(sum <10 && sum >5)

bucky is really awesomeee

you are "very ugly"

Bucky really is awesome

how sad ;(

I added all the operations to the calculator from the earlier lesson using this <3! It's a bad calculator in everyday terms, but I got it to work. I could get away without using the operations' variables, but whatever.

#include <iostream>

using namespace std;

int main()

{

int a;

int b;

int x;

int div;

int sum;

int diff;

int prod;

cout<<"Please enter a number. ";

cin>>a;

cout<<"Please enter another number. ";

cin>>b;

div=a/b;

sum=a+b;

diff=a-b;

prod=a*b;

cout<<"Please choose your operation n1. Division n2. Addition n3. Subtraction n4. Multiplication n";

cin>>x;

if(x==1){cout<<"The division equals to "<<div<< " and the remainder equals to "<<a%b;}

if(x==2){cout<<"The addition equals to "<<sum;}

if(x==3){cout<<"The difference equals to "<<diff;}

if(x==4){cout<<"The product equals to "<<prod;}

if(x>4){cout<<"Invalid option, the program will now close.";}

if(x==0){cout<<"Invalid option, the program will now close.";}

return 0;

}

bucky is awsome

Can someone tell me what I did wrong?

#include <iostream>

using namespace std;

int main()

{

int a = 98;

int b = 76;

if (a>5) {

cout << "Bucky is AWESOME!!!!";

}

return 0;

I got.

"Boneless Chicken"

pretty cool huh)) put it on 2x speed)

Pretty cool huh?

when can i build AI like google assistant? is this going to be in the next tutorial?

so Bucky is not always awesome? lol jk XD

:3

#include <iostream>

#include <Windows.h>

using namespace std;

int main()

{

float a;

float b;

float total;

cout << "Hey Thanks for using my calculator enter two numbers!" << endl;

cin >> a;

cout << "Alright, enter a second number" << endl;

cin >> b;

total = a + b;

cout << total << endl << endl;

if(total==69){

cout << "Hey You have a dirty mind!" << endl;

}

else

{

cout << "Alright bud you got it!" << endl;

}

system("pause");

}

Bucky is always awesome !!!!!!

whatever if 1>3 or 5>3 i don`t care about this shit. i hate maths

You're a legend

little cheat for people. you don't have to write int everytime,for ex. :

int a;

int b;

int c;

…

sometimes you can just write :

int a,b,c,…;

I can make a calculator xD

have u made any big projects using C++ programming language?

Bucky is AWESOME !!!

Thanks Bucky, very enjoiable and clear teaching 🙂

Bucky truly is AWESOME!!!! thanks a lot for this tutorial.

This is so easy especially coming from a python background

is

76 != 25 and 76 =! 25

the same thing? or will it only work one way?

i understand that it can be used for >>

what if if i was supposed to write this

int a;

int b;

int miracle;

if (a = miracle)

will the program recognize a word?

Just… how many times you gotta repeat " Bucky is awesome" ??

#include <iostream>

using namespace std;

int main (){

cout <<" welcome to the world of simple calculations nn";

int a,b,c,d,e,f,x,y;

cout << "press 0 to continue or any other no. To quitnn" ;

cin>> y;

if (y==0){

cout << " welcome nn";

cout << "enter a numbernn";

cin>> a;

cout << "enter a another numbern";

cin>> b;

cout << " press 1 to add 2 to sub 3 to multiply and 4 to divide" << endl;

cin>> x;

}else {

cout << "goodbye, have a nice day" << endl;

}

c = a+b;

d = a-b;

e = a*b;

f = a%b;

if (x==1){

cout << "the addition of the nos you entered is" << c << endl;

}

if (x==2){

cout << "the subtraction of the nos you enterd is << d << endl;

}

if (x==3){

cout << "the multiplication of the nos you enterd is << e << endl;

}

if (x==4){

cout << "the division of the nos you enterd is << f << endl;

}

if (x>4){

cout << "goodbye, come back later" << endl;

}

return 0;

}

I know there are a bit of bugs…but help me with the division…i think thats causing a bit of problem. Anyways, a rough program for simple calculator…rate it please…it would b helpful

should I be taking notes

who is here now in aug ?

and 21 years old?

hands up

Its always the 6th line of code "[" by itself that C++ says its wrong????