Project 1: Creat a Digital Clock in C (Mini Projects for Beginners)

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024
  • in this video you will see how easy it is to creat a simple clock in c using for loops.

ความคิดเห็น • 251

  • @trikkee
    @trikkee ปีที่แล้ว +7

    Best regards !
    With Linux as a bro told me :
    system("sleep 1");
    system("clear");
    Commands are used with additional header .
    Computer clock works with high frequency that's why we use these two functions below.

  • @kanishkmishra1017
    @kanishkmishra1017 3 ปีที่แล้ว +72

    Bro it's awesome anybody can learn it finally got a legit program

    • @BITACADEMY23
      @BITACADEMY23 3 ปีที่แล้ว +2

      th-cam.com/channels/vX4ERU0DvgQqR1Uw4WpNuw.html

    • @w花b
      @w花b 2 ปีที่แล้ว +2

      I started doing all the challenges on codecademy that I've done in python but it's completely different and so much longer to implement.

  • @icephonex
    @icephonex 2 ปีที่แล้ว +120

    for people coding in Linux you can use #include instead of #include . Then you can use system() to enter a bash command (e.g. system("sleep 1") or system("clear))

    • @AD_ArnvD0323
      @AD_ArnvD0323 2 ปีที่แล้ว +2

      I am a windows user, but thanks! You helped people like me, who dont know so much

    • @LesCodes
      @LesCodes 2 ปีที่แล้ว +1

      love you

    • @godl_disaster611
      @godl_disaster611 ปีที่แล้ว +1

      Thanks for better explanation 🙂

  • @DaRza17
    @DaRza17 3 ปีที่แล้ว +299

    Meanwhile I'm trying to figure out why my "Hello World" is giving me segmentation fault error...😂👌

    • @Darkspell1947
      @Darkspell1947 2 ปีที่แล้ว +1

      haha

    • @prathmeshbatane8740
      @prathmeshbatane8740 2 ปีที่แล้ว +7

      You just have to close previous exe file.. 🤷‍♂️

    • @DaRza17
      @DaRza17 2 ปีที่แล้ว +1

      @@prathmeshbatane8740 Lol

    • @akashnathsong1483
      @akashnathsong1483 2 ปีที่แล้ว +1

      ​@@prathmeshbatane8740 😂😂😂

    • @nafiz4012
      @nafiz4012 2 ปีที่แล้ว +1

      Lol

  • @technicalnavez634
    @technicalnavez634 3 ปีที่แล้ว +28

    That was amazing
    Love the way you teach
    Thanks for making this awesome video

  • @sandisosenzo
    @sandisosenzo 3 ปีที่แล้ว +14

    this is great. Looking forward to upcoming projects

  • @michaelmoore6642
    @michaelmoore6642 3 ปีที่แล้ว +56

    For those whose time stuck at 00.00.1
    Try d=1 instead of 1000 cause the difference is in second

  • @mathankumar1408
    @mathankumar1408 3 ปีที่แล้ว +2

    Thanking so much.....
    One of the great TH-cam channel..
    I am learn something new.... Super super superb lots and lots of Thanking you

  • @HenriqueMartins-in2ci
    @HenriqueMartins-in2ci ปีที่แล้ว +1

    Very cool, I see you from Brazil!

  • @rowlandmchinyira
    @rowlandmchinyira 2 หลายเดือนก่อน

    great

  • @harshthakur4243
    @harshthakur4243 ปีที่แล้ว +3

    I am having problem in declaring sleep() function

  • @KeyserTheRedBeard
    @KeyserTheRedBeard 2 ปีที่แล้ว +2

    intense upload Programming Tests and Projects. I shattered that thumbs up on your video. Keep up the quality work.

  • @CoderMala
    @CoderMala 5 หลายเดือนก่อน +1

    👍

  • @Genubath1
    @Genubath1 ปีที่แล้ว +4

    Would this run slow eventually because each second would be 1000 ms plus however long it takes to execute the loop?

  • @joydeepdutta5216
    @joydeepdutta5216 ปีที่แล้ว +1

    Simple yet deadly

  • @ShahabKhan-re9xp
    @ShahabKhan-re9xp ปีที่แล้ว +1

    Outstanding work

  • @aryushgupta8680
    @aryushgupta8680 2 ปีที่แล้ว +5

    Thank you so much bro🔥
    Awesome content☺

  • @gingerninja2269
    @gingerninja2269 3 ปีที่แล้ว +6

    This is beginners stuff!!! Really!.

  • @ajlee3113
    @ajlee3113 หลายเดือนก่อน

    i love ur vscode font colors! How can I get that same one?

  • @manoharrathore614
    @manoharrathore614 3 ปีที่แล้ว +1

    Too good

  • @Chimpys
    @Chimpys 2 ปีที่แล้ว

    love the music bro and thnx

  • @peterpanini96
    @peterpanini96 ปีที่แล้ว

    Do c into graphic programs pls that would be very usefull... how to sincronize and in tegrate graphic windows and c code...

  • @mohamedaitcheikh4393
    @mohamedaitcheikh4393 2 ปีที่แล้ว +2

    bro u maked a litlle mistak in ur code
    if(h>12)
    {
    h=0;
    }
    h suposed to back to 0 not 1

  • @uchennagodfrey8343
    @uchennagodfrey8343 ปีที่แล้ว

    So nicee

  • @nipundahiya9705
    @nipundahiya9705 3 ปีที่แล้ว +1

    nice

  • @aliqaim673
    @aliqaim673 2 ปีที่แล้ว

    Great, Love from UK🇬🇧

  • @nayyabshahzad8655
    @nayyabshahzad8655 3 ปีที่แล้ว +4

    I want to learn how to form a project of restrictions enzymes in C programming

  • @ascutecoupleslove
    @ascutecoupleslove 2 ปีที่แล้ว +1

    Amazing ❤️

  • @subhamsharma269
    @subhamsharma269 3 ปีที่แล้ว +5

    amazing and understandable.

  • @fahadgilal1257
    @fahadgilal1257 ปีที่แล้ว

    Really like it bro 👍👍

  • @mathankumar1408
    @mathankumar1408 3 ปีที่แล้ว +1

    Awsome 🔥🔥🔥🔥🔥

  • @dipakk3477
    @dipakk3477 3 ปีที่แล้ว +5

    Wow easy and simple
    👍
    👍
    👍
    I'll try it now ❤️❤️

  • @1up504
    @1up504 2 ปีที่แล้ว

    I thought that the clock had to get the actual real time... and i found time.h, works like a charm! lol

  • @regular4993
    @regular4993 2 ปีที่แล้ว

    Super, bro.

  • @vanguard6982
    @vanguard6982 2 ปีที่แล้ว

    Awesome.

  • @rajkr9
    @rajkr9 3 ปีที่แล้ว

    Niceeee...

  • @Starmanfansunofficial
    @Starmanfansunofficial ปีที่แล้ว

    ❤❤❤❤

  • @pritambera10
    @pritambera10 3 ปีที่แล้ว

    nice bhai

  • @RahulSaini-pp5kz
    @RahulSaini-pp5kz 2 ปีที่แล้ว

    wow

  • @unecotech919
    @unecotech919 2 ปีที่แล้ว

    Nice bro

  • @prajeetapatil4626
    @prajeetapatil4626 2 ปีที่แล้ว

    Bruhhh!!! That's awesome...
    Could you tell me what your theme is!??? Plzzzz?? It looks fantastic!!!

    • @programmingtestsandproje
      @programmingtestsandproje  2 ปีที่แล้ว +1

      thank you, my theme is styrokai++

    • @prajeetapatil4626
      @prajeetapatil4626 2 ปีที่แล้ว

      @@programmingtestsandproje thanks bruhhh so much... I wish you happiness!!!😍🥰
      Bruh and one more thing....
      How do you get rid of all the unwanted output and get a clean and neat output...?? Do you have a video on this... Or please tell me how to do that!!! Plzzzz

  • @Skyy0072
    @Skyy0072 3 ปีที่แล้ว

    Really good

  • @TheGamerInc26
    @TheGamerInc26 2 ปีที่แล้ว

    Nice ! Easy to Understand.

  • @lmaox265
    @lmaox265 ปีที่แล้ว +1

    salut mon frere !

  • @karim47161
    @karim47161 3 ปีที่แล้ว +2

    Thanks dude , do u have any idea how can i do that in a real project , programming an integer card , with monitor ... ?

  • @gichiarello
    @gichiarello 2 ปีที่แล้ว +2

    My function "sleep(d)" keeps getting errors, "implicit declaration of function 'sleep'"

    • @dami3nb
      @dami3nb 21 วันที่ผ่านมา

      Sleep() function is with a capital S, Sleep(d);

  • @samwartachitrakar9674
    @samwartachitrakar9674 3 ปีที่แล้ว +6

    I'm trying this on an online compiler and the code #include shows as fatal error: windows.h: No such file or directory

    • @YarikASMRPOMIRCHIY
      @YarikASMRPOMIRCHIY 3 ปีที่แล้ว +1

      ye duh

    • @punya3597
      @punya3597 3 ปีที่แล้ว

      You can't include header files in online compiler. You need to carry this out on an offline compiler like VSCode or CodeBlocks.

    • @samwartachitrakar9674
      @samwartachitrakar9674 3 ปีที่แล้ว

      @@punya3597 thanks

    • @dilipkn7339
      @dilipkn7339 3 ปีที่แล้ว

      @@punya3597 same happened to me in vscode as well
      Will windows.h work in linux

    • @punya3597
      @punya3597 3 ปีที่แล้ว

      @@dilipkn7339 I don't think linux includes windows.h library, you might have to port the functions you need from other header files e.g.Xlib.h

  • @arun.a2k
    @arun.a2k 2 ปีที่แล้ว +1

    Where I can excute this program can anyone tell me about it

  • @ronnygamerz88
    @ronnygamerz88 3 ปีที่แล้ว +1

    0:21 what its mean , without watching ur peogramme(video) or without seeing o/p ??

  • @faizahafra7665
    @faizahafra7665 2 ปีที่แล้ว +1

    It worked!

    • @anjanabhat6576
      @anjanabhat6576 2 ปีที่แล้ว +1

      In which compiler did you try?

    • @faizahafra7665
      @faizahafra7665 2 ปีที่แล้ว +1

      @@anjanabhat6576 Codeblocks 16.01

    • @saziyasays67
      @saziyasays67 8 หลายเดือนก่อน

      It is not working in turbo c++...can you please tell me why

  • @benmoussarachida4016
    @benmoussarachida4016 3 ปีที่แล้ว +2

    Thank you bro 🌹

    • @Dee71911
      @Dee71911 3 ปีที่แล้ว +1

      Why use file ?

    • @not_herobrine3752
      @not_herobrine3752 3 ปีที่แล้ว

      @@Dee71911 it contains the Sleep() function

  • @sai_umesh
    @sai_umesh ปีที่แล้ว

    What is the use of delay of 1000 ms
    And using it in sleep function

  • @gingerninja2269
    @gingerninja2269 3 ปีที่แล้ว +7

    Is it possible to make this the desktop clock? Perhaps add quirks like Seconds counting back and forward while still accumulating time?

    • @BITACADEMY23
      @BITACADEMY23 3 ปีที่แล้ว

      th-cam.com/channels/vX4ERU0DvgQqR1Uw4WpNuw.html

    • @obamagaming3802
      @obamagaming3802 2 ปีที่แล้ว +4

      you can get the desktop clock if you use the time.h header, you can do it like time_t s; s = time(NULL) and as for the seconds counting backwards, you just need to use basic maths, just tell it to print 59 minus the seconds which will make the place in the seconds count down instead of up and voilá, i've done it and it works

  • @marvensjx3389
    @marvensjx3389 2 ปีที่แล้ว +3

    So for system(CLS); how would i implement this on xcode because I made a clock that tells day and time but since it's in an Infinite loop. It prints out every iteration. So my screen is filled a lot of line of code.

    • @mediationsound7280
      @mediationsound7280 2 ปีที่แล้ว

      system("cls")

    • @pratikyadav.9201
      @pratikyadav.9201 ปีที่แล้ว

      Same problem !

    • @Hmmmwhatarewedoing
      @Hmmmwhatarewedoing ปีที่แล้ว

      Since the system command is running system functions, the command to execute here is dependent on the operating system you’re running the script from. The Windows command is cls for clear screen, but if you’re on a linux/unix type OS like Mac (I’m assuming you are since you mentioned xcode) the commend should be clear, so system(“clear”), but like someone else mentioned, writing out an escape sequence instead is better practice since this won’t be OS dependent

  • @ayoub6608
    @ayoub6608 2 ปีที่แล้ว +1

    wich theme you're using

  • @mayurlohar1567
    @mayurlohar1567 2 ปีที่แล้ว +1

    Can I do in android phone with Turbo C app???

  • @chinmaysatam8555
    @chinmaysatam8555 ปีที่แล้ว

    Don't know why I copied the exact code still the clock does not run it os taking the inputs of h m s and not running afterwards

  • @adeifefadahunsi6908
    @adeifefadahunsi6908 ปีที่แล้ว +1

    If system("cls") does not work on your terminal, try system("clear").

  • @Silemthhll-gd3kf
    @Silemthhll-gd3kf 9 หลายเดือนก่อน

    Why is every project idea ether incredible hard or super ez

  • @PUNYAKEERTHANAS
    @PUNYAKEERTHANAS ปีที่แล้ว

    Hi sir, it won't working when I am giving input as 0 0 0 for h, m, s in online compiler.Then what can i do for that. Is there any need of installation of any other software.

  • @cjster999
    @cjster999 2 ปีที่แล้ว +1

    bro i'm making this program in c++ and the program is running good
    but the problem is the time between every second is so fast that i can't even read the output
    please solve this

    • @mehakbatra6194
      @mehakbatra6194 2 ปีที่แล้ว

      Can u pls give me the code.... I want to try... Pls pls

    • @sahadhshanavas437
      @sahadhshanavas437 2 ปีที่แล้ว

      try increasing the value of "d".

  • @anything9276
    @anything9276 3 ปีที่แล้ว

    thxxx for the help

  • @anwarbounagui2239
    @anwarbounagui2239 3 ปีที่แล้ว +2

    what vsc theme is that?

  • @as9499
    @as9499 ปีที่แล้ว +1

    I am new at C.
    So can someone explain why he put %2d instead of %d while printing the time after the 3 if statements?

    • @samuelogboye
      @samuelogboye ปีที่แล้ว +2

      so that each value appears like 01 and not 1

    • @as9499
      @as9499 ปีที่แล้ว

      @@samuelogboye thanks mate

  • @NNNedlog
    @NNNedlog 2 ปีที่แล้ว

    Thanks a lot

  • @agent7gaming
    @agent7gaming ปีที่แล้ว

    bro there is a delay with the real time....the second in this program increases slow in comparison of real time....how to solve this plz tell....

  • @batmandc3799
    @batmandc3799 2 ปีที่แล้ว +1

    Not going to lie it's looks kinda easy😅

  • @AV_0718
    @AV_0718 ปีที่แล้ว

    for you its running continously but for me it was stuck up at 00:00:01 !!! any solution

  • @prasannawithanage2864
    @prasannawithanage2864 ปีที่แล้ว

    i have tried ,but not working it says "sleep(d)^ not declared!"

  • @AddictedxShortxVideo29
    @AddictedxShortxVideo29 3 ปีที่แล้ว +7

    I am using now the Code Blocks but it stuck in 10:00:00 and I already tested the "d=1" instead of d=1000.

  • @vamshianimela2452
    @vamshianimela2452 2 ปีที่แล้ว +1

    im getting output as ERROR !

  • @abhishekaaryabgp
    @abhishekaaryabgp 3 ปีที่แล้ว

    Thank you soo much 😍

  • @sandraswift7280
    @sandraswift7280 3 ปีที่แล้ว

    what compiler do you user? much better looking than codeblocks lol

  • @jayasuriya7047
    @jayasuriya7047 2 ปีที่แล้ว +2

    Can you send the code now bro please

  • @gerardjagroo
    @gerardjagroo ปีที่แล้ว

    I don't know what I did wrong but it keeps asking for input infinitely.

  • @obamagaming3802
    @obamagaming3802 2 ปีที่แล้ว +1

    using system() function is a bad practice, you're better off using an escape sequence like \033[A which will work in every system

    • @Rei-m3g
      @Rei-m3g 2 ปีที่แล้ว

      @Yor Kar cuz there's bad in it

  • @bhuvneshgautam3856
    @bhuvneshgautam3856 2 ปีที่แล้ว

    When I run this and set time at 000 it shows error of process returned why

  • @zan4887
    @zan4887 2 ปีที่แล้ว +2

    Can someone tell me what this theme he uses for VS Code is

  • @Quasar_Energy
    @Quasar_Energy 3 ปีที่แล้ว +2

    Code breaks for me at ```printf("
    %02d:%02d:%02d", h,m,s)``` does not print the time

  • @_Anna_Nass_
    @_Anna_Nass_ 2 ปีที่แล้ว

    Wouldn’t you want
    if(h>12|| m>59|| sec>59)
    instead ?

    • @homosapiens...
      @homosapiens... 2 ปีที่แล้ว

      second passes instantly so 59 sec will be a minute the next moment

  • @aritradebnath849
    @aritradebnath849 ปีที่แล้ว

    You didn't show the sleep function

  • @manjusha6998
    @manjusha6998 2 ปีที่แล้ว

    Bro memu projects chedham anukuntunnam memu projects ela cheyyali, maaku projects Cirtificate kaavali bro resume lo pettukovadaniki

  • @shobhadagur3284
    @shobhadagur3284 2 ปีที่แล้ว

    What's there in 7 line.. Please tell

  • @sai_umesh
    @sai_umesh ปีที่แล้ว

    Why should we use delay

  • @geraldtochukwu2081
    @geraldtochukwu2081 ปีที่แล้ว

    Some corrections in your code.
    while(1)
    {
    s++;
    if (s>59)
    {
    m++;
    s=0;
    }
    if (m>59)
    {
    h++;
    m=0;
    }
    if (h>11)
    {
    h=0;
    }

  • @hackergtx8731
    @hackergtx8731 2 ปีที่แล้ว

    Which Ide??

  • @pipobex
    @pipobex 2 ปีที่แล้ว +1

    What is the sleep command in C++

    • @Rei-m3g
      @Rei-m3g 2 ปีที่แล้ว

      It puts you to sleep .

  • @harshkapoor9612
    @harshkapoor9612 2 ปีที่แล้ว +2

    still waiting for new videos its been 2 years🙂

  • @sriharipulipati93929
    @sriharipulipati93929 2 ปีที่แล้ว

    Bro in which compiler you did this.

  • @anithareddy9620
    @anithareddy9620 2 ปีที่แล้ว

    Hi
    While executing it shows like compilation terminated and no such file or directory

  • @xx19crypto
    @xx19crypto 3 ปีที่แล้ว +4

    Bro it stuck in 00:00:01 whats the problém??

    • @programmingtestsandproje
      @programmingtestsandproje  3 ปีที่แล้ว +1

      show me your code

    • @michaelmoore6642
      @michaelmoore6642 3 ปีที่แล้ว +2

      @@programmingtestsandproje same problem bro

    • @programmingtestsandproje
      @programmingtestsandproje  3 ปีที่แล้ว +1

      @@michaelmoore6642 show me your code so i can see what you did wrong

    • @michaelmoore6642
      @michaelmoore6642 3 ปีที่แล้ว +4

      @@programmingtestsandproje
      #include
      #include
      int main()
      {
      int h,m ,s,d;
      int d=1000; //delay of 1000 miliseconds and we will use it in the function sleep
      printf("set time:
      ");
      scanf("%d%d%d",&h,&m,&s);
      if(h>12 || m>60 || s>60)
      {
      printf("ERROR !
      ");
      exit(0);
      }
      while(1) //this is an infinite loop and anytjing inside will repeat isdelf to infinity
      {
      s++;
      if (s>59)
      {
      m++;
      s=0;
      }
      {
      if (m>59)
      h++;
      m=0;
      }
      if (h>12)
      {
      h=1;
      }
      printf("
      Clock:");
      printf( "
      %02d:%02d:%02d" ,h,m,s); //this writes one tome in format 00:00:00
      sleep(d); //the function sleep slow down the while loop and make it more like a real clock
      system("cls");
      // this clears the screen
      }
      }

    • @lasthero4419
      @lasthero4419 3 ปีที่แล้ว +5

      try d=1 cause the time is in seconds not in milliseconds

  • @lakshmiprasannachowdhary2362
    @lakshmiprasannachowdhary2362 2 ปีที่แล้ว

    Where we have to do this I mean any software??

  • @danielschagerl3657
    @danielschagerl3657 ปีที่แล้ว

    So "int h,m,s" is like
    "int h;
    int m;
    int s;"?

  • @huzaifatalibbhai1562
    @huzaifatalibbhai1562 3 ปีที่แล้ว +1

    which theme you use for vscode😊

  • @syairahbell8259
    @syairahbell8259 3 ปีที่แล้ว

    can i know what the algorithm,pseudocode and flowchart.

  • @elvicjuhnrecanil309
    @elvicjuhnrecanil309 2 ปีที่แล้ว

    Is windows.h required in android?

  • @muhammadnabil4243
    @muhammadnabil4243 2 ปีที่แล้ว

    Hi can i know why my second kinda slow

  • @_w0rmz928
    @_w0rmz928 2 ปีที่แล้ว

    i am having problems with printf("set time :
    ");

  • @arpitkushwah3408
    @arpitkushwah3408 ปีที่แล้ว

    Who was watching at 0.25x 😂😅

  • @Maybemiles_C
    @Maybemiles_C 2 ปีที่แล้ว

    is it only run in vs code???