C Programming Tutorial – 21 – Dont Beat Up Little Kids

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


Posted

in

by

Tags:

Comments

28 responses to “C Programming Tutorial – 21 – Dont Beat Up Little Kids”

  1. Mark Anthony Nilo Avatar

    Hey Bucky Sir!,I want to add another comment that if someone is not a good student. Then He is Bad student,and add comment like "Study Hard Next time" but im having error message in the code… it says, "error "else" without a previous "if".
    Did I miss something?
    This is the code I'm trying to write.

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
    int hoursStudied = 60;
    int kidsBeatUp=9;

    if( (hoursStudied>=10) && (kidsBeatUp=0) );{
    printf("You are a Good Student!");
    }else{ //THIS IS WHERE THE RED BLOCK ERROR APPEAR
    printf("Please study Harder");
    }
    return 0;
    }

    Thank You Bucky Sir!, and Everyone else who might answer me.

  2. Hassan Khan Avatar

    Type this……,,,

    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
    int hoursStudied = 80;
    int kidsBeatUp = 1;

    if ( (hoursStudied >= 10) && (kidsBeatUp == 0) ){
    printf ("You are a good student");
    }else{
    printf ("You are not good student");
    }
    return 0;
    }

  3. Sam Avatar

    this is mine, pretty much the same tho,
    #include <stdio.h>
    #include <stdlib.h>
    #include<conio.h>
    int main(void)
    {
    int kidsbeaten;
    int hourstudied;
    printf("How many kids have you beaten up?");
    scanf_s("%d", &kidsbeaten);
    printf("How many hours have you studied?");
    scanf_s("%d", &hourstudied);
    if ((kidsbeaten == 0) && (hourstudied >= 10))
    {
    printf("You are a good student");
    }
    else
    {
    printf("THATS A DETENTION!");
    }
    _getch();
    return 0;
    }

  4. Marko Mitrovic Avatar

    How did he manage to beat up that many kids and study for 80 hours a week?

  5. Douglas Oak Avatar

    Mine throws and error when I put both arguments in brackets. I have to write it like this instead :

    if(stars > 0 && planets > 0 )
    {
    printf("You have a solar system");
    }
    else {

  6. Rishab Agarwal Avatar

    can we use && and || together in a programme?

  7. kalexander777 Avatar

    Great video, have fun beating them kids up, Bucky!!

  8. Alacaster Soi Avatar

    This way is more fair

    int main()
    {

    int HStudied = 80;
    int KBS = 3;

    if(HStudied >= 80)
    { KBS -= 5; }

    if(KBS == 0)
    { HStudied += 7; }

    if((KBS <= 0) && (HStudied >= 10))
    {
    printf("you are a good student n");
    }

    }

  9. HABELFOC _ Avatar

    Hello guys, can tell me why this code not print "Welcome" even though i have signed the variable of my "username" and "password"

    int main()
    {
    char realUserName = "habel";
    char realPassword = "hello";

    char userName;
    char password;

    printf("Enter you username: n");
    scanf(" %s", &userName);

    printf("Enter you password: n");
    scanf(" %s", &password);

    if ( (userName == realUserName) && (password == realPassword) ) {

    printf("Welcome /n");
    } else {
    printf("You username or password is wrong n");
    }

    return 0;
    }

  10. Dubious Claims Avatar

    Solid help from you, man.

    Thanks much.

  11. shizyninjarocks Avatar

    Beat up little kids, they're easy experience points.

  12. Rayane Avatar

    look what I made, and tell me your opinion :

    int hoursstudied;
    int kidsbeatup;

    printf("how many hours did u study this week? n");
    scanf(" %d", &hoursstudied);

    printf("how many kids did you beat this week? n");
    scanf(" %d", &kidsbeatup);

    if((hoursstudied>10) && (kidsbeatup==0)){
    printf("You re a good student");
    }else if( (hoursstudied==10) && (kidsbeatup==0) ){
    printf("You re an average student");
    }else{
    printf("you re a bad student");
    }

  13. Mahmoud Chahine Avatar

    Here is a more detailed program I made
    #include <stdio.h>
    #include <string.h>

    int main()
    {
    system("COLOR 0C");
    int kidsbeatup; // if 0 then the student is good
    int howmanyhours;
    printf("Are you a good studentn");
    printf("How many kids have you beat up?n");
    scanf("%d", &kidsbeatup);
    printf("How many hours have you studied per week?n");
    scanf("%d", &howmanyhours);
    if ((kidsbeatup==0) && (howmanyhours>=60)) {
    printf("You rock keep up the good workn");
    printf("Hours of study: %dn", howmanyhours);
    printf("Students beat up: %dn", kidsbeatup);
    }
    else if ((kidsbeatup==0) && (howmanyhours<60)) {
    printf("You are an average studentn");
    printf("Hours of study: %dn", howmanyhours);
    printf("Students beat up: %dn", kidsbeatup);
    }
    else if ((kidsbeatup>0) && (howmanyhours>=60)) {
    printf("You beat up kids, but you work hardn");
    printf("I'm calling your parents for beating up %d studentsn", kidsbeatup);
    printf("Hours of study: %dn", howmanyhours);
    printf("Students beat up: %dn", kidsbeatup);
    }

    else if ((kidsbeatup>0) && (howmanyhours<60)) {
    printf("Your are suspended for your bad behaviorn");
    printf("Hours of study: %dn", howmanyhours);
    printf("Students beat up %dn", kidsbeatup);
    }
    return 0;

    }

  14. Jett Calder Avatar

    Hello! Can you show me how to textcolor(conio.h) in this codeblock?

  15. Pawel J Avatar

    How on Earth do you study 60 hours a week? Even if you include school time you still have 30 hours left.

  16. Abdikhaliq Avatar

    He was not in a good mood and he beat up 12 kids.

  17. Marco Antonio Graziano de Castro Avatar

    Hehehehe. This is what happen when you learn C Programmin in this channel.

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
    float money;
    int age;

    printf("Goog Night! Welcome to the Paradise World!n");
    printf("Firstly, I have to know how old you are:n");
    scanf(" %d", &age);

    printf("Ok.n");
    printf("How much money you pretend to spend here, today?n");
    scanf(" %f", &money);

    if( (age >= 18) && (money >= 5000) ){
    printf("Excelent! We love potential clients!n");
    printf("You may come in already, fell free to help yourself.n");
    printf("In a few moments, one of our VIP girls will meet you.n");

    }else if( (age >= 18) && (money >= 1000) ){
    printf("Great. Welcome!.n");
    printf("You may come in already, fell free to help yourself. n");
    printf("In a few moments, one of our girls will meet you.n");

    }else if ( (age < 18) && (money >= 1500) ){
    printf("For this particular ocasion, we will allow you to come in.n");
    printf("I ask you to come in, fell free to help yourself and one of our girls will meet you.n");

    }else if ( (age < 18) && (money <1500) ){
    printf("Sorry, kid.n");
    printf("We only accept adult people to come in.n");
    printf("Come back to your home and do your homework.");
    }

    return 0;
    }

  18. ZURATAMA1324 Avatar

    What is this //? (double slash)
    Is it a free comment section like /**/?

  19. Xeno ZDBZ Avatar

    im using windows 10

  20. tessie abraham Avatar

    these lessons are so good..thank you so much

  21. Anas Haouat Avatar

    you could make it interactive with scanf and asking with a printf ("how much hours did you study this week n" )

  22. I React to Everything ! Avatar

    Very useful videos but please what software are you using

  23. Youtube Käyttäjä Avatar

    Beating up kids is a bad habit for sho

  24. March Machine Avatar

    I be like…….Just 60 hours..

  25. Must Päike Avatar

    If you have an idea, you can already make a text-type game with tihis information so far.

  26. Must Päike Avatar

    Try to run this 😀

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        int hoursStudied;
        int kidsBeatUp;

        /*DEFAULT
        int hoursStudied = 60;
        int kidsBeatUp = 0;
        */

        printf("How many hours have you studied in a week? n");
        scanf("%d", &hoursStudied);   /** SCAN FOR hours studied**/

        printf("How many kids have you beaten up? n");
        scanf("%d", &kidsBeatUp);   /** SCAN FOR kids beaten**/

        /*USE if( (test1) && (test2) && (test3) && (test4) ) */

        if( (hoursStudied >=10) && (kidsBeatUp ==0) )

        {
            printf("You are a good student!");
        }

        else
        {
           printf ("You have been a baaaad fella!");
        }

        return 0;
    }

Leave a Reply

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