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
Amazon Auto Links: No products found.
Bucky, i love you bro ! thanks god still exist people like you man. Keep up the good work, Greetings from Berlin
if i were to input “yn” i would still get it right, how do i prevent that?
#include
#include
int main()
{
int favorite ;
printf(“If you like COD or Java then you are my best friendn”);
scanf(” %d” , &favorite);
if ((favorite == ‘COD’) || (favorite == ‘Java’)){
printf(“You are my best friend”);
}else{
printf(“We are enemies”);
}
return 0 ;
}
This code never runs the “printf(“You are my best friend”); ” if the answer is COD or Java it skips that and prints We are enemies
Hm, having a struggle. I dont know the difference between arrays and variables. Makes it difficult to know when to put &.
Im not from the Us and i see lots of comments like “Your videos help me a lot at school”. My question is: is coding a common subject in the Us?
Hi these videos are amazing but I wonder if you could zoom in your text quite a bit because it’s very hard to sit back and watch on my small 1080p monitor.
great way to learn…
I write this code. When I put 71, it says “Bad choice.”, but when I put 7.9, it says”You make the right choice”. Why?
#include
#include
int main()
{
int number;
printf(“What is your favorite number? n”);
scanf(” %d”, &number);
if(number==7 || number==1){
printf (“nYou make the right choice.n”);
}else{
printf(“Bad choice.n”);
}
return 0;
}
Please….. What software are using ???
how do you make the program do or in a way that it it wont trigger if both are try
like?
if ( (test1) || (test1)){
if ((test1) && (test2)){
}else{
\do some code here
}
}
just seems like a lot of code to me is all
and it is nly making people to leave this tuts and went to other . . .
if i use true/false instead of y/n then how to deal with this?
eg.
char answer;
printf(“Hexagonal have 6 side ? (True/False) n”);
scanf(” %s”, &answer);
(answer == ‘true’ ) ? printf(“Right!”) : printf(“Wrong!”);
every time i am getting answer “Wrong” why? please help
#include
#include
int main()
{
char decision;
printf(“Do you love coding? n”);
scanf(“%c”,&decision);
if((decision==’y’)||(decision==’n’)) {printf(“You’re awesome ! n”);}
else {printf(“You should watch more Bucky’s videos and you will love it ! n”);
}
return 0;
}
Bucky is such an inspiration !
I am falling in love with programming since i started watching your videos !
-An aspiring programmer
and love for bagels !
hello guy’s , it doesn’t work with me this time when i use the “or” symbol “||” !! any one can help??!
and the problem is when i change it from characters to integer it works !!!!!!!!
Meatball
Bucky you are a life saver!!!!!!!! Thanks bro.
– A college student
I know this is stupid and simple compared to your guys’ stuff but I’m proud of it:
#include
#include
int main()
{
char answer;
printf(“Do you have school tomorrow? y/n n”);
scanf(” %c”, &answer);
if( (answer==’y’) || (answer==’n’) ){
printf(“Didn’t ask you. Shut it. n”);
}
int scale;
printf(“On a scale of 1-10, how mad are you right now? n”);
scanf(” %d”, &scale);
if(scale > 5){
printf(“ur mad lel n”);
}
if(scale < 5){ printf("Get mad then! n"); } printf("Goodbye."); return 0; }
your so awesome
make sure to use single quotes instead of double quotes when checking a statement. Single quotes are used for chars and double for strings.
Zero dislikes!!
erm.. why did you use %c instead of %s for string? and why we use single quotation instead of double quotation for y and n? is it because of y and n are not a string? if it is not a string then what it is?
It is gonna be displayed as “good job” even if they type ” yes” instead of just “y” because it stars with a “y” or “n”. 🙂
What about xor? C must have something like this, am I right?
yesss dat one dislike is meee ye mee lol
0 dislike here… awesome!!
Thanks a lot for those videos . i’m starting to study electrical engineering in Berlin and i watched all your videos to help me to get ready for my studies .
cant you print more else if statements? or am I stupid?
y u r not increasing the size of fonts …coz it become too difficult to read what u r tying even on 1080 px quality . . .
Can any body help me here .
I actually try running this code, but I keep getting error with in the if state that I don’t understand, the program is about asking user for their login name and afterward make sure that they provide the required name, using the if statement.
#include
#include
int main(){
char name[10]; // jubril, darame
printf(“Enter Login namen”);
scanf(” %s”, name);
printf(“welcome %s”, name);
if (name == “jubril”) {
printf(“you welcome sire “);
}
else{
printf(“sorry u are not autorized here”);
}
}return 0;
Screen Shot 2015-05-01 at 10.41.22 PM.png
Thanks a lot for these videos, your really good at explaining this c programming!!! helped out a lot in my class CMIS 102… Keep it going man!!
thanks!
First video on youtube with this many views/likes and zero dislikes!……… I think I shall make this sacrifice……
in java for comparing string we use .equalsto() function …. do we use it here also ????
Hey I know this is just a simple example to show the OR test but I ran the program and entered yn and the program returned ‘good job you didn’t mess anything up’ How would you structure it so that it can ONLY be y or and not both? Cheers