C Language Travel Agency Manager Exercise 7 Solution: C Tutorial In Hindi #46

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024
  • In this series of C programming in hindi tutorial videos, I have explained you everything you need to know about C language. I hope you are enjoying this C in Hindi course.
    ►This C Lecture is a part of this C Programming Course: • C Language Tutorials I...
    ►Source Code + Notes: codewithharry....
    ►Click here to subscribe - / @codewithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Learn Python In Hindi ...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithha...
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

Комментарии • 235

  • @chirntn
    @chirntn Год назад +19

    For future Viewers :
    1. in this program, Scanf will not take whitespace , so use fgets
    2. However, you will have to use scanf for integer input, which when combined with fgets, will not allow you to take string input for the next fgets, as scanf generates newline charecter(
    ) which gets consumed by fgets and hence you'll not be able to take input
    3. To solve this , write getchar(); function after each scanf so that it consumes the newline charecter , thus allowing you to take input .

    • @clubsign36
      @clubsign36 Год назад

      i wrote using gets, posted the code as a reply to ur comment, can u post ur code with fgets plz

    • @md.adnanparwez215
      @md.adnanparwez215 Год назад

      ​@@clubsign36
      See
      #include
      #include
      typedef struct drivers
      {
      char name[20];
      char license[30];
      char route[20];
      float kms
      }d;
      int main()
      { int n,len;
      printf("Enter number of drivers :");
      scanf("%d",&n);
      getchar();
      d drivers[n];
      for(int i =0;i

  • @barunjena6171
    @barunjena6171 3 года назад +15

    Thank you sir. You had made it easier by keeping the number of drivers to three. But I wanted to make it hard for myself so that I learn more, so I made the program for n number of drivers and I was successful in making the program in less than 50 lines. Yes, I used for loop twice, once for taking input and once for printing output. Thank you sir 🙏❤️

    • @shreyadasmahapatra5332
      @shreyadasmahapatra5332 3 года назад

      can u please show me the code

    • @barunjena6171
      @barunjena6171 3 года назад +2

      @@shreyadasmahapatra5332 give me your email id so that I can send the c file to you

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      @@stubborn1861
      I have used this code for solving it by loop method . If you found this useful please like this so that others can see it . I spent a lot of time on this.
      I have used array as structure variable and passed it as argument to the function display.
      But we can't decide the length of array s beforehand so I took it = 10( long enough)
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

    • @zenon8627
      @zenon8627 2 года назад

      @@stubborn1861 he probably declared the structure variable as an array
      Struct d
      {
      definition
      } dn[] ;

    • @gamingwithrksaver4868
      @gamingwithrksaver4868 2 года назад

      Same here

  • @palakpanpaliya829
    @palakpanpaliya829 4 года назад +15

    Hey which job do you do as you are an excellent teacher do you work like a software engineer also

  • @ankeshkumar5753
    @ankeshkumar5753 4 года назад +11

    Sir you are a motivation for us doing great job!! keep going

  • @rahulkumarkeshriiitbhu3932
    @rahulkumarkeshriiitbhu3932 Год назад +3

    thank you harry bhai

  • @mysterioustech6030
    @mysterioustech6030 5 лет назад +6

    Harry bhai please make a video on Data Structures.....

  • @mrhuntsman5623
    @mrhuntsman5623 7 месяцев назад +3

    harry bhai you could use loop for detail entering as if there were many than what to do i tried and got the desired outcome and i used array for structre

    • @KAMADO-EDITZ.55
      @KAMADO-EDITZ.55 3 месяца назад

      I also used the array of structure to solve this problem

  • @sunnyyadav5860
    @sunnyyadav5860 5 лет назад +4

    I like your video so much 🙏🙏

  • @justcodeit5032
    @justcodeit5032 4 года назад +4

    loved your course☺☺

  • @engineerbhai7642
    @engineerbhai7642 5 лет назад +3

    Bestcoder in you tube

  • @sbshort950
    @sbshort950 5 лет назад +3

    Great tech

  • @mohammedilyazkhan5425
    @mohammedilyazkhan5425 3 года назад +2

    Really a great explanation Harry Bhai
    Because of ur explaination I have started programming in c
    Keep going on bro you are doing an great job🙂

  • @farazshah2773
    @farazshah2773 4 года назад +3

    Thank you for yout course

  • @gamingangsuk4940
    @gamingangsuk4940 2 года назад +1

    Thank you for your guidance

  • @aakashsaini_85
    @aakashsaini_85 2 года назад +3

    Bro mana bhi aasa hi likha tha but Mera first input lakr sabhi nicha k print kr rha hai. Or aaga wala scanf bhi ignore kr rha hai.

  • @RohanDasRD
    @RohanDasRD 5 лет назад +2

    Are Bhai Bhai bhai Bhai Naya exercise a gaya

  • @rupamjyotidas736
    @rupamjyotidas736 5 лет назад +3

    Vai genetic algorithm pe video banaiye please ☺

  • @NitinKumar-qk1fi
    @NitinKumar-qk1fi 4 года назад +3

    Bewt bro got it easily

  • @abrarulhaqsanadi8905
    @abrarulhaqsanadi8905 2 года назад +7

    I have used loops here
    #include
    #include
    struct driver
    {
    char name[50];
    char licence_no[5];
    char route[50];
    int kms;
    }data[2];
    int main()
    {
    int i,n;
    printf("Enter Number Of drivers: ");
    scanf("%d",&n);
    for(i=0;i

    • @ankushghosh1799
      @ankushghosh1799 Год назад

      can you please explain why data [2] ?

    • @md.adnanparwez215
      @md.adnanparwez215 Год назад

      data[n] hoga na just declare it after asking for n

    • @Rounakrk
      @Rounakrk 4 месяца назад +1

      @@ankushghosh1799 he took data[2] as an array , means only 2 driver details can be entered. he should have took data[n] after taking value of n by the user

    • @ankushghosh1799
      @ankushghosh1799 4 месяца назад

      @@Rounakrk thanks brother

  • @sakshipatil2094
    @sakshipatil2094 3 года назад +1

    thank you

  • @vickyfutbal
    @vickyfutbal 3 года назад +3

    Sir, in this program I add money in the struct and run this program by for loop. Run successfully. But I want to add the total money earned in a day by the travel agency, I failed. Apart from this, I used in this program Goto statement, how will it work? Because goto statement isn't working. Please help.

  • @sudhirtheindian
    @sudhirtheindian 3 года назад +1

    very
    nice

  • @codewithharryfanchannel559
    @codewithharryfanchannel559 5 лет назад +4

    You have deep knowledge of the programming

  • @redsharingan6190
    @redsharingan6190 2 года назад +2

    you should use loop here for many inputs that make the code small
    #include
    #include
    struct drivers
    {
    char name[50];
    char licNum[50];
    char route[50];
    char KMs[50];
    } driver;
    int main()
    {
    while (1)
    {
    printf("1 enter your name:
    ");
    printf("2 enter your license number:
    ");
    printf("3 enter your route:
    ");
    printf("4 enter your kms:
    ");
    gets(driver.name);
    gets(driver.licNum);
    gets(driver.route);
    gets(driver.KMs);
    printf("your Name is:%s
    ", driver.name);
    printf("your licNum is:%s
    ", driver.licNum);
    printf("your route is:%s
    ", driver.route);
    printf("your Kms is:%s
    ", driver.KMs);
    }
    return 0;
    }

    • @ManishRajput-cq5tj
      @ManishRajput-cq5tj Год назад +2

      Bhai pehel ise chla k dekh bss ek hi person ka input lega ye or sirf likh while 1 pura program to bna le ..

  • @rishabhshah5619
    @rishabhshah5619 3 года назад +3

    Sir when i give spaces in between route name then it does not ask for printing my km.But when i dont give spaces between characters then it ask for printing kms

    • @yashrawat747
      @yashrawat747 2 года назад

      @kashu🐣 is there any alternative
      like I tried using gets but It mess my code

  • @arijitdas4560
    @arijitdas4560 3 года назад +2

    what you said at the very first time in the the video that to take take the input from the user that how many drivers's info he want to print .....
    please help me to write that code...
    big follower sir ❤

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      I have used this code for solving it by loop method . If you found this useful please like this so that others can see it . I spent a lot of time on this.
      I have used array as structure variable and passed it as argument to the function display.
      But we can't decide the length of array s beforehand so I took it = 10( long enough).
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

    • @vatsalsharma4061
      @vatsalsharma4061 Год назад +1

      #include
      #include
      struct l {
      char name[35];
      int license;
      char route[100];
      int km;
      };
      int main() {
      start:
      int n;
      printf("enter no of driver
      ");
      scanf("%d",&n);
      struct l m[n];

      for (int i=0;i

  • @sciesteam
    @sciesteam 5 лет назад +1

    Bhai isme for loop use karte to accha lagta 😊😊😊😊

  • @OnlineITtraining
    @OnlineITtraining 5 лет назад +5

    Good Tutorial Love from Pakistan 💞

  • @PHANTOM-pi4ve
    @PHANTOM-pi4ve Год назад +1

    sir there is no source code in ur website for this video
    there is a blank space in that box where source code must be prsent

  • @anuraganand8361
    @anuraganand8361 2 года назад +1

    Kms not printing integer but if i put zero it's run . How can i solve it?

  • @SaiOmkar-p6p
    @SaiOmkar-p6p 2 месяца назад

    Hairy bhoi ap blast ho😊😊

  • @jaikrishnakumar8192
    @jaikrishnakumar8192 3 года назад +2

    your question was different. It was to take input n from user but here you have predefined d1,d2,d3 and so on...

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      haan bro yahin krna tha toh isse hamaari coding skills kaise develop hui. Bas typing ki practice hui. Mujhe laga woh har data ke liye ek array banayenge aur phir array slicing se value print krdenge( like in python) but slicing isn't present in c language . So you can't print name of all drivers at once ( without manually taking input for all three).

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      I have used this code for solving it by loop method . If you found this useful please like this so that others can see it . I spent a lot of time on this.
      I have used array as structure variable and passed it as argument to the function display.
      But we can't decide the length of array s beforehand so I took it = 10( long enough).
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

    • @vatsalsharma4061
      @vatsalsharma4061 Год назад

      #include
      #include
      struct l {
      char name[35];
      int license;
      char route[100];
      int km;
      };
      int main() {
      start:
      int n;
      printf("enter no of driver
      ");
      scanf("%d",&n);
      struct l m[n];

      for (int i=0;i

  • @justcodeit5032
    @justcodeit5032 4 года назад +2

    bhaiya kuch challenging do na jo jyada dimag khaega

  • @anujjain1492
    @anujjain1492 3 года назад

    Harry bhai is hero.

  • @sehajpreetsingh8616
    @sehajpreetsingh8616 4 года назад +3

    Can we do it with loops?

    • @SanjayKumar-lx1fm
      @SanjayKumar-lx1fm 2 года назад

      #include
      #include
      int main()
      {
      int n;
      struct driver
      {
      char name[50];
      int license;
      char route[50];
      int kms;
      } ta[20];
      printf("------------Welcome sk tarvel agency--------------
      ");
      printf("Enter the number of drivers details you want to fill:
      ");
      scanf("%d",&n);
      for (int i = 0; i < n; i++)
      {
      printf("
      %d. Enter the driver name
      ",i+1);
      scanf("%s", &ta[i].name);
      printf("Enter the licence number:
      ");
      scanf("%d", &ta[i].license);
      printf("Enter the route:
      ");
      scanf("%s", &ta[i].route);
      printf("Enter the kilometres you drive:
      ");
      scanf("%d", &ta[i].kms);
      }
      printf("----------Drivers Information---------------------
      ");
      for (int i = 0; i < n; i++)
      {
      printf("
      %d. Driver Name:%s
      ",i+1,ta[i].name);
      printf("License Number=%d
      ", ta[i].license);
      printf("Route=%s
      ", ta[i].route);
      printf("kilometres=%d
      ", ta[i].kms);

      }
      return 0;

      }

  • @rohittekchandani7778
    @rohittekchandani7778 4 года назад +4

    Sir, nahi he sorce code ess vale video me 😟😟😟

  • @official-hk9vx
    @official-hk9vx 5 лет назад +3

    Harry bhia not satisfied with this solution😐
    Pls tell here how we can reduse lines here with loop and one more thing gets() why not used here bcs scanf will terminate string name when driver enter their name with space
    I tried many time but could't
    Pls solve it with loop and gets function

    • @nareshgoyal1994
      @nareshgoyal1994 4 года назад

      bro if you know that how it can be improved then why are you asking him to solve it again................

    • @yashrawat747
      @yashrawat747 2 года назад

      @@nareshgoyal1994 bro this is really very long way of solving this

    • @yashrawat747
      @yashrawat747 2 года назад

      i tried using gets ,
      but it is messing with my code 😞

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      @@yashrawat747
      I have used this code for solving it by loop method . If you found this useful please like this so that others can see it . I spent a lot of time on this.
      I have used array as structure variable and passed it as argument to the function display.
      But we can't decide the length of array s beforehand so I took it = 10( long enough).
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

  • @jiteshsharma9621
    @jiteshsharma9621 4 года назад +4

    Sir notes

  • @mandarbuchake2430
    @mandarbuchake2430 3 года назад +1

    How to use for loop in these

  • @LearniverseNurseryRhymes
    @LearniverseNurseryRhymes 4 месяца назад

    The %s format specifier in scanf expects a char* argument, which is the address of the first element of a character array. When we write d1.name, it already decays to char*, which is the correct type. Then how are you using &d1.name, which will be of type char** (pointer to pointer to character array)? Why do it not gives error? I have tried it without & (d1.name) and it works fine.

    • @SwarnadipDutta
      @SwarnadipDutta 3 месяца назад

      you're right.

    • @SwarnadipDutta
      @SwarnadipDutta 3 месяца назад

      can u see my code???
      idk why but it is giving me some unpredictable behavior while taking inputs

    • @SwarnadipDutta
      @SwarnadipDutta 3 месяца назад

      #include
      #include
      struct info
      {
      char name[30];
      int driving_license_id;
      char route[30];
      int Kms_travelled;
      };
      int main()
      {
      int n;
      printf("The number of drivers is: ");
      scanf("%d" , &n); // For the sake of simplicity , put n = 3;
      struct info drivers[n];
      struct info a;
      printf("

      Dear drivers, please give your infos:
      ");
      for(int i = 0; i < n ; i++)
      {
      printf("Driver no.%d:
      " , i+1);
      printf("Name: ");
      scanf("%s" , (a.name));
      printf("Driving License ID: ");
      scanf("%d", &(a.driving_license_id));
      printf("Route: ");
      scanf("%s" , (a.route));
      printf("Kms travelled while recruited in the agency: ");
      scanf("%d", &(a.Kms_travelled));
      printf("
      ");
      drivers[i] = a;
      }
      printf("

      The drivers' info is thereby:
      ");
      for(int i = 0 ; i < n ; i++)
      {
      a = drivers[i];
      printf("Driver no.%d:
      " , i+1);
      printf("Name: %s
      " , a.name);
      printf("Driver's License ID: %d
      " , a.driving_license_id);
      printf("Route: %s
      " , a.route);
      printf("Kms travelled while recruited in the agency: %d
      " , a.Kms_travelled);
      printf("
      ");
      }
      return 0;
      }

  • @yashchaudhari13
    @yashchaudhari13 5 лет назад +2

    Bhai how to type fast ????

  • @VrajShah-y1q
    @VrajShah-y1q Год назад +2

    if n is unknown number then how to declare n variables in the structure?

    • @md.adnanparwez215
      @md.adnanparwez215 Год назад

      #include
      #include
      typedef struct drivers
      {
      char name[20];
      char license[30];
      char route[20];
      float kms
      }d;
      int main()
      { int n,len;
      printf("Enter number of drivers :");
      scanf("%d",&n);
      getchar();
      d drivers[n];
      for(int i =0;i

    • @LavishKamboj01
      @LavishKamboj01 7 месяцев назад +1

      Pta chal gya ho to muche bhi bta de bhai

    • @mrhuntsman5623
      @mrhuntsman5623 7 месяцев назад

      bhai uskke liye apko ek structure ka array banana padega.uske bad appko ek for loop me users ka data entry karna padega.@@LavishKamboj01

    • @mrhuntsman5623
      @mrhuntsman5623 7 месяцев назад +1

      /*
      You manage a travel agency and you want your n drivers to input their following details:
      1. Name
      2. Driving License No
      3. Route
      4. Kms
      Your program should be able to take n as input(or you can take n=3 for simplicity) and
      your drivers will start inputting their details one by one.
      Your program should print details of the drivers in a beautiful fashion.
      User structures.
      */
      #include
      int main()
      {
      int num;
      struct driver
      {
      char name[40];
      char lis[40];
      char route[40];
      int kms;
      };

      printf("

      \"**********Welcome to the Driving Agency**********\"

      ");
      printf("Enter the number of diver's whose detail you want to store:
      ");
      scanf("%d",&num);
      getchar();
      struct driver detail[num];
      for (int i = 0; i < num; i++)
      {
      printf("Please provide the details of DRIVER NO %d:
      ", i + 1);
      printf("Enter the name:");
      gets(detail[i].name);
      printf("Enter the License No:");
      gets(detail[i].lis);
      printf("Enter the Route:");
      gets(detail[i].route);
      printf("Enter the approx number of KMs Driven:");
      scanf("%d", &detail[i].kms);
      getchar();
      printf("

      ");
      }
      printf("

      **********The Details of drivers in our agency is:**********

      ");
      for (int i = 0; i < num; i++)
      {
      printf("The name of Driver %d is :%s
      ", i + 1, detail[i].name);
      printf("The License No is :%s
      ", detail[i].lis);
      printf("The Route is :%s
      ", detail[i].route);
      printf("The approx number of KMs Driven is :%d
      ", detail[i].kms);
      printf("

      ");
      }
      printf("
      ");
      return 0;
      }
      @@LavishKamboj01

  • @sachinjain1641
    @sachinjain1641 3 года назад

    Ok here n value is 3 so happily we have done it what if n value is 100 then it will become complicated so how to solve it easily

  • @harshvardhan7368
    @harshvardhan7368 3 года назад

    Jb selected portion m typing krte h tb intellisense work nhi krta. Uske lie 2 baar cursor ko neeche ya upar le jake wapis se shi jagah laake type krne se intellisense work krne lagta h

  • @Ajuuuuuuuuuu
    @Ajuuuuuuuuuu 8 месяцев назад

    Bhaiya pointer to function ka video please 🥺

  • @souviksaha435
    @souviksaha435 3 года назад +2

    Sir, scanf aur gets ek saath kaam nehi kar raha hai

    • @anubhavkalra7216
      @anubhavkalra7216 3 года назад

      Brother you can use "fflush(stdin);" to clear buffer but use it before writing "gets" in your program.

  • @SunnyKumar-wz3lb
    @SunnyKumar-wz3lb 4 года назад +2

    Sir iss solutions k sir code nhi mil rehe sir plzz give....from Delhi

  • @-BhaveshDewangan
    @-BhaveshDewangan 3 года назад

    Harry bhai iss question ko loop se kaise solve kar sakte hai..??
    Please btaiye...

  • @rosonerri-faithful
    @rosonerri-faithful 3 года назад

    How to do it using user input and looping?

  • @r.kprabhakar9839
    @r.kprabhakar9839 3 года назад +2

    can we solve this problem by using loops ??

    • @anubhavkalra7216
      @anubhavkalra7216 3 года назад

      yes we can use looping in this, I'm adding my Source code in this comment. I hope it will help you!!

    • @r.kprabhakar9839
      @r.kprabhakar9839 3 года назад

      @@anubhavkalra7216 thanks brother

    • @r.kprabhakar9839
      @r.kprabhakar9839 3 года назад +2

      @@anubhavkalra7216 please share me source code

    • @mandarbuchake2430
      @mandarbuchake2430 3 года назад +2

      @@anubhavkalra7216 plz share me source code for loop in structure

    • @anubhavkalra7216
      @anubhavkalra7216 3 года назад +2

      @@mandarbuchake2430 Brother I'd posted the source code in the above replies you can copy from there and If you can't find it then let me know.. I'll give you my code through mail.

  • @tacnopsgaming9137
    @tacnopsgaming9137 2 года назад

    sir vs code m bhot problems aati hai uski settings hi etni sari h ki hame kuch samajh nhi aata sir kya aap DEFAULT SETTINGS ki video bna sakte hai aur uske sath saare important extensions ki. idk why it is not compiling my code even tho its right i was ubuntu user

  • @vedsingh1528
    @vedsingh1528 5 лет назад +4

    Bhai pygame tut plz

    • @deepaktiwari-ry9yo
      @deepaktiwari-ry9yo 5 лет назад

      Pygame ke tutorial already sir ne bna ke rkha hai....

    • @vedsingh1528
      @vedsingh1528 5 лет назад

      @@deepaktiwari-ry9yo heme aur game chaiye

  • @devendr09
    @devendr09 3 года назад +3

    @CodeWithHarry How to do the same program for 'n' drivers, taking 'n' as input from user?

    • @divyanshjindal18
      @divyanshjindal18 3 года назад +2

      Bro u can use concept of arrays in structures
      like struct driver d[n];
      and take n from user using scanf.

    • @yashrawat747
      @yashrawat747 2 года назад

      ​@@divyanshjindal18 like sir has taken d1 ,d2 ,d3
      is there any way that we can take it from user like I tried in this way :
      #include
      #include
      struct drivers
      {
      char name[50];
      int distance ;
      char route[50];
      };
      int main(int argc, char const *argv[])
      {
      // you have to take three drivers
      char full_name[3][40];
      for (int i = 1; i

  • @NeetuYadav-ht8pz
    @NeetuYadav-ht8pz 2 года назад +1

    can we use loop

    • @_stakegambler
      @_stakegambler 2 года назад

      #include
      #include
      struct drivers
      {
      char Name[30];
      char Driving_Licence[30];
      float KM;
      } Driver_1, Driver_2, Driver_3;
      int main()
      {
      printf(">

      ");
      while (1)
      {
      for (int i = 1; i < 4; i++)
      {
      printf("\tEnter your identy according to the No.
      Driver_%d
      Name : ", i);
      scanf("%s", &Driver_1.Name);
      printf("Driving_licence : ");
      scanf("%s", &Driver_1.Driving_Licence);
      printf("KM : ");
      scanf("%f", &Driver_1.KM);
      printf("
      ");
      printf("Driver_%d status
      %s
      %s
      %f km
      ", i, Driver_1.Name, Driver_1.Driving_Licence, Driver_1.KM);
      }
      }
      return 0;
      }

  • @navinkumar-sn4dg
    @navinkumar-sn4dg 5 лет назад +2

    I am 7th comment

  • @suryanshjaiswal7149
    @suryanshjaiswal7149 Год назад

    Humbhi solve kiye hain

  • @divikas4495
    @divikas4495 4 года назад +2

    Can we use for loop ???
    It will be less of code I guess

    • @barunjena6171
      @barunjena6171 3 года назад

      Yes you can. I can give you my source code if you give me your email id.

    • @divikas4495
      @divikas4495 3 года назад +1

      @@barunjena6171 thank you for the reply ☺️
      I completed the entire series.
      Now I am learning Java

    • @barunjena6171
      @barunjena6171 3 года назад

      @@divikas4495 wow, as soon as I complete this course, I will be learning python😀👍

    • @divikas4495
      @divikas4495 3 года назад +1

      @@barunjena6171 before learning python learn Data structures and algorithms

    • @barunjena6171
      @barunjena6171 3 года назад +1

      @@divikas4495 okay, thanks for the tip. I will look into it.

  • @pankajwandre5961
    @pankajwandre5961 5 лет назад +2

    Bhai mera program run hi nahi kiya aapne

  • @tamoghnasomdas5057
    @tamoghnasomdas5057 3 года назад

    why you cant use for loop?

  • @shambhavshandilya8865
    @shambhavshandilya8865 3 года назад

    harry how will i assign no. of driver taken by user input lets say 10 then how will i initialize structure with 10 ,please tell

    • @vatsalsharma4061
      @vatsalsharma4061 Год назад

      #include
      #include
      struct l {
      char name[35];
      int license;
      char route[100];
      int km;
      };
      int main() {
      start:
      int n;
      printf("enter no of driver
      ");
      scanf("%d",&n);
      struct l m[n];

      for (int i=0;i

  • @allinone7s
    @allinone7s 5 месяцев назад

    Sir mere laptop me vs code nhii chal rha hai
    Jab antivirus off kar rha hu tab chal rha hai
    Abb Mai kya kru ?
    Sir please reply

  • @spyboytuber2106
    @spyboytuber2106 3 года назад +2

    Can someone pls tell how can this be done using for loop?

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      I have used this code for solving it by loop method . If you found this useful please like this so that others can see it . I spent a lot of time on this.
      I have used array as structure variable and passed it as argument to the function display.
      But we can't decide the length of array s beforehand so I took it = 10( long enough).
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

    • @shiva_gaming8122
      @shiva_gaming8122 2 года назад

      #include
      /*you manage a travel agency and you want your n drivers to input their
      following details:*
      1 . Name
      2. Driving License No.
      3. Route
      4. Kms*/
      struct deriverdetails{
      char Name[34];
      int LicenseNo;
      char Route[50];
      int kms;
      }s[5];
      int main(){
      int n,i;
      printf("Enter the number of drivers to fill the details :
      ");
      scanf("%d",&n);
      for(i=1;i

    • @vatsalsharma4061
      @vatsalsharma4061 Год назад

      #include
      #include
      struct l {
      char name[35];
      int license;
      char route[100];
      int km;
      };
      int main() {
      start:
      int n;
      printf("enter no of driver
      ");
      scanf("%d",&n);
      struct l m[n];

      for (int i=0;i

  • @arpitmahajan2323
    @arpitmahajan2323 Год назад

    there is no code provided in the source code link plz check brother.

  • @apoorv8256
    @apoorv8256 2 года назад

    There is no print show after the line **priinting the details of the driver**
    In my code.।। Can anyone help

  • @palakpanpaliya829
    @palakpanpaliya829 4 года назад +2

    I will hire you I am the CEO of various company like marcer

  • @kunalsah9639
    @kunalsah9639 5 лет назад +2

    First viewer

  • @ayanavadas6154
    @ayanavadas6154 3 года назад +2

    ********* The source code is blank. **********

  • @ankitsoni5096
    @ankitsoni5096 Год назад

    Sir, while using the gets() and puts() function in it, why the program not worked properly.
    I'm stuck with this question.

    • @vatsalsharma4061
      @vatsalsharma4061 Год назад

      it would not same problem here its compiler error use gets char() for correct output here my soution
      #include
      #include
      struct l {
      char name[35];
      int license;
      char route[100];
      int km;
      };
      int main() {
      start:
      int n;
      printf("enter no of driver
      ");
      scanf("%d",&n);
      struct l m[n];

      for (int i=0;i

  • @yashsonawane5341
    @yashsonawane5341 3 года назад +4

    I did solve the same way.
    I thought there must be another method cause this one is very lengthy method!!!

    • @parthjoshi5939
      @parthjoshi5939 3 года назад

      you can use for loop and functions

    • @yashrawat747
      @yashrawat747 2 года назад

      i tried to do it
      it took me whole freaking 10 days to automate but 😞 sir did it in very common way

    • @yashrawat747
      @yashrawat747 2 года назад

      @@parthjoshi5939 i though of how many drivers from users and wanted to take input from user and put it in front of struct
      but I fail very badly ,

  • @Plu3to
    @Plu3to Год назад

    How to make it for n numbers of drivers ?
    Please reply

    • @helloworld2054
      @helloworld2054 Год назад

      Make an array of structures, take n as an input (say n) and then write:
      Struct name_of_structure Array_name[n];

  • @RavitejMulay
    @RavitejMulay Год назад

    bro why didnt use array instead than typing all of this much ??

  • @khajasab9442
    @khajasab9442 Год назад

    How replicat the code sentence

  • @CarryMinati-jz4ku
    @CarryMinati-jz4ku 10 месяцев назад

    Sir please solve this problem by loop 🙏.

    • @VarunG-y6p
      @VarunG-y6p 10 месяцев назад

      Bro i solved it using loop, i was expecting harry bhai to do the same but idk why he did it that way.
      #include
      /*
      You manage a travel agency and you want your n drivers to input their following details:
      1. Name
      2. Driving License No
      3. Route
      4. Kms
      Your program should be able to take n as input(or you can take n=3 for simplicity) and your drivers will start inputting their details one by one.
      Your program should print details of the drivers in a beautiful fashion.
      User structures.
      */
      struct details{
      char name[20][20], licenseNum[20][20], route[20][20];
      int kms[];
      };
      int main()
      {
      int n;
      char companyName[20][20];
      struct details d1, d2, d3,d4,d5;
      printf("Enter the name of your company:
      ");
      scanf("%[^
      ]", &companyName);
      printf("Enter the number of drivers working under you:
      ");
      scanf("%d", &n);
      printf("Enter the details below:
      ");
      for (int i = 0; i < n; i++)
      {
      printf("Input Details of Driver %d
      Name of the driver: ", i+1);
      scanf("%s", &d2.name[i]);
      printf("License number of the driver: ");
      scanf("%s", &d3.licenseNum[i]);
      printf("Route taken by the driver: ");
      scanf("%s", &d4.route[i]);
      printf("Number of KiloMetres driven under service: ");
      scanf("%d", &d5.kms[i]);
      }
      printf("The Details of The Drivers Working Under %s are:
      ", companyName);
      for (int j = 0; j < n; j++)
      {
      printf("Name: \t%s
      ", d2.name[j]);
      printf("License Number: \t%s
      ",d3.licenseNum[j]);
      printf("Route: \t%s
      ", d4.route[j]);
      printf("KiloMetres Driven: \t%d
      ", d5.kms[j]);
      }
      }

    • @CarryMinati-jz4ku
      @CarryMinati-jz4ku 10 месяцев назад

      @@VarunG-y6p us moment 🫂.

  • @MrSoaib123
    @MrSoaib123 2 года назад +1

    Soaib aslam

  • @JohnDoe-kj2cs
    @JohnDoe-kj2cs 3 года назад

    For loop se kya

  • @vedsingh1528
    @vedsingh1528 5 лет назад +2

    First

  • @aajicooks7420
    @aajicooks7420 3 года назад

    yaar apne to bola the ki n number of drivers and wo n user dalega issiliye bohot confusion hogaya

  • @kajolkeshri65
    @kajolkeshri65 3 года назад +2

    anybody who has solved this question with the help of loops. pls let me know. i am finding the loop method for this question

    • @prateekapurva3464
      @prateekapurva3464 3 года назад +2

      make array of structures D[3]; and then use it in loop. For ex. for loop in i:&D[i].name etc.

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      @नाक
      I have used this code for solving it by loop method . If you found this useful please like this so that others can see it . I spent a lot of time on this.
      I have used array as structure variable and passed it as argument to the function display.
      But we can't decide the length of array s beforehand so I took it = 10( long enough).
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

  • @ManishRajput-cq5tj
    @ManishRajput-cq5tj Год назад

    Loop ka use kark program chota kaise kare

    • @VarunG-y6p
      @VarunG-y6p 10 месяцев назад

      Aise:
      #include
      /*
      You manage a travel agency and you want your n drivers to input their following details:
      1. Name
      2. Driving License No
      3. Route
      4. Kms
      Your program should be able to take n as input(or you can take n=3 for simplicity) and your drivers will start inputting their details one by one.
      Your program should print details of the drivers in a beautiful fashion.
      User structures.
      */
      struct details{
      char name[20][20], licenseNum[20][20], route[20][20];
      int kms[];
      };
      int main()
      {
      int n;
      char companyName[20][20];
      struct details d1, d2, d3,d4,d5;
      printf("Enter the name of your company:
      ");
      scanf("%[^
      ]", &companyName);
      printf("Enter the number of drivers working under you:
      ");
      scanf("%d", &n);
      printf("Enter the details below:
      ");
      for (int i = 0; i < n; i++)
      {
      printf("Input Details of Driver %d
      Name of the driver: ", i+1);
      scanf("%s", &d2.name[i]);
      printf("License number of the driver: ");
      scanf("%s", &d3.licenseNum[i]);
      printf("Route taken by the driver: ");
      scanf("%s", &d4.route[i]);
      printf("Number of KiloMetres driven under service: ");
      scanf("%d", &d5.kms[i]);
      }
      printf("The Details of The Drivers Working Under %s are:
      ", companyName);
      for (int j = 0; j < n; j++)
      {
      printf("Name: \t%s
      ", d2.name[j]);
      printf("License Number: \t%s
      ",d3.licenseNum[j]);
      printf("Route: \t%s
      ", d4.route[j]);
      printf("KiloMetres Driven: \t%d
      ", d5.kms[j]);
      }
      }

  • @anonymouskali6055
    @anonymouskali6055 5 лет назад +2

    sir i'm Deepak from firozaabd up 283203

  • @Sovit705
    @Sovit705 3 года назад

    aapka computer slow nahi. mere sath bhi yahi hota hai.C program itna slow kyu hota hai
    ?

  • @lazzysubh3160
    @lazzysubh3160 5 лет назад +2

    Harry please start your coaching classes i am ready to join where u say. At any place.
    By the way where u from.
    Thank you for this knowledge.
    And please reply.
    Pata hai bade log ho par reply jurur dena

  • @RohanSaluja
    @RohanSaluja 3 года назад

    How %s is working with ampersand(&)?

    • @shykhexe
      @shykhexe 3 года назад

      Scanf() only works with ampersand "&"

    • @yashrawat747
      @yashrawat747 2 года назад

      no for string as far as i know there is no need for & while taking string input with the help of scanf 🙂

  • @mamunallrasid7553
    @mamunallrasid7553 3 года назад

    Please Give New Project

  • @tanmay_b_07
    @tanmay_b_07 3 месяца назад

    08-06-24

  • @mohitparwani4235
    @mohitparwani4235 3 года назад

    why didn't we used "gets()" to take the input of string

    • @ALLINONE-kt7wd
      @ALLINONE-kt7wd 3 года назад +2

      Only for simplicity bro

    • @yashrawat747
      @yashrawat747 2 года назад

      @नाक first i m getting warnign
      and also my code isn't working properly with gets

  • @om5540
    @om5540 4 года назад +8

    Meri intellisence to ati hi ni hai😂😂😂

  • @ompaltomar8418
    @ompaltomar8418 5 лет назад +2

    bhai visual c++ error in python

  • @sahil00234
    @sahil00234 2 года назад

    source code was disappear

  • @mahendrajain6752
    @mahendrajain6752 3 года назад

    Accept challenge

  • @arpangarg1907
    @arpangarg1907 Год назад

    mera loops se nahi ho rha

    • @vatsalsharma4061
      @vatsalsharma4061 Год назад

      #include
      #include
      struct l {
      char name[35];
      int license;
      char route[100];
      int km;
      };
      int main() {
      start:
      int n;
      printf("enter no of driver
      ");
      scanf("%d",&n);
      struct l m[n];

      for (int i=0;i

    • @arpangarg1907
      @arpangarg1907 Год назад

      @@vatsalsharma4061 Thanks bro, I had already solved my problem.

  • @The_Raj_Singh
    @The_Raj_Singh 2 года назад

    Agr main name k beech me space de deta hu to wo next step me DL no. nhi poch rha seedhe route pr chala jaa rha.
    How to solve this?
    Pls tell

  • @hitech9815
    @hitech9815 3 года назад

    my name is Himanshu Shah

  • @sumanpal4787
    @sumanpal4787 4 года назад +7

    #include
    #include
    struct driverin
    {
    char name[30];
    int dl;
    float kms;
    };
    void main()
    {
    struct driverin d1,d2,d3;
    int n;
    printf("Enter 1 to give deteils for driver 1,
    2 to give details for driver 2,
    3 to give details for driver 3
    ");
    scanf("%d", &n);
    switch (n)
    {
    case 1:
    {
    printf("give your name to print
    ");
    scanf("%s", &d1.name);
    printf("give& your dl to print
    ");
    scanf("%d", &d1.dl);
    printf("give how much distance you have visited with the car to print
    ");
    scanf("%f", &d1.kms);
    printf("So the driver name is %s
    ,His dl number is %d
    ,He visted %f kms with the car
    ", d1.name, d1.dl, d1.kms);
    break;
    }
    case 2:
    {
    printf("give your name to print
    ");
    scanf("%s", &d2.name);
    printf("give your dl to print
    ");
    scanf("%d", &d2.dl);
    printf("give how much distance you have visited with the car to print
    ");
    scanf("%f", &d2.kms);
    printf("So the driver name is %s
    ,His dl number is %d
    ,He visted %f kms with the car
    ", d2.name, d2.dl, d2.kms);
    break;
    }
    case 3:
    {
    printf("give your name to print
    ");
    scanf("%s", &d3.name);
    printf("give your dl to print
    ");
    scanf("%d", &d3.dl);
    printf("give how much distance you have visited with the car to print
    ");
    scanf("%f", &d3.kms);
    printf("So the driver name is %s
    ,His dl number is %d
    ,He visted %f kms with the car
    ", d3.name, d3.dl, d3.kms);
    break;
    }
    }
    return;
    }

    • @firebout7675
      @firebout7675 2 года назад

      great

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      this won't work because after entering driver1 details it will encounter break command ,and the code will end.
      you can't print the info of all drivers at once

    • @siddharthchampia5674
      @siddharthchampia5674 2 года назад

      This is better
      #include
      #include
      struct data
      {
      int km;
      int dlno;
      char name[30];
      char route[20];
      }s[10];
      display(struct data s[],int n)
      {
      for(int i=1;i

    • @charlottefx7163
      @charlottefx7163 2 года назад

      @@siddharthchampia5674 Exactly, but if he removes break it will work

    • @shridharchaudhari1832
      @shridharchaudhari1832 2 года назад

      @@charlottefx7163 to fayada kya hi huva switch case use karne ka, directly hi likh deta

  • @rohanbhaikapc
    @rohanbhaikapc 8 месяцев назад

    take n number of drivers using loops
    #include
    typedef struct driverinfo
    {
    char name[100];
    char lic[50];
    char r[100];
    float dist;
    } Driverinfo;
    int main()
    {
    Driverinfo s[10];
    int n;
    printf("Enter the number of Drivers
    ");
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
    printf("Enter %d driver name
    ", i + 1);
    scanf("%s", &s[i].name);
    printf("Enter the licsene of %d driver
    ", i + 1);
    scanf("%s", &s[i].lic);
    printf("Enter the route of the %d driver
    ", i + 1);
    scanf("%s", &s[i].r);
    printf("Enter the distance traveel by the %d driver
    ", i + 1);
    scanf("%f", &s[i].dist);
    }
    printf("*******Drivers info*********
    ");
    printf("NAME\t DLNO\t ROUTE\t DISTANCE
    ");
    for (int i = 0; i < n; i++)
    {
    printf("%s\t%s\t%s\t%f
    ", s[i].name, s[i].lic, s[i].r, s[i].dist);
    }
    return 0;
    }
    thankyou

  • @sonukumar-nc1er
    @sonukumar-nc1er 2 года назад +1

    /*
    0.structure :
    1.structure are used to create user defined data types.
    2.its usually used to store dissimilar data together.
    QUESTION:
    3.Write a program using loop in structure?
    SOLUTION :-
    */
    #include
    #include
    typedef struct
    {
    char name[55];
    int dl;
    char date[20];
    char route[80];
    float kms;
    } details;
    int main()
    {
    int n = 3;
    details details[n];
    printf("Enter driver details

    ");
    for (int i = 0; i < n; i++)
    {
    printf("driver:%d

    ", i + 1);
    printf("NAME :");
    scanf("
    %[^
    ]s", &details[i].name);
    printf("ROUTE :");
    scanf("
    %[^
    ]s", &details[i].route);
    printf("D.L.NO :");
    scanf("%d", &details[i].dl);
    printf("D.O.B :");
    scanf("
    %[^
    ]s", &details[i].date);
    printf("DISTANCE :");
    scanf("%f", &details[i].kms);
    printf("
    ");
    }
    printf("---------------DEATAILS OF DRIVERS---------------
    ");
    for (int i = 0; i < n; i++)
    {
    printf("DRIVER:%d

    ", i+1);
    printf("NAME\t:%s
    ", details[i].name);
    printf("ROUTE\t:%s
    ", details[i].route);
    printf("D.L.NO\t:%d
    ", details[i].dl);
    printf("D.O.B\t:%s
    ", details[i].date);
    printf("DISTANCE:%f KMS
    ", details[i].kms);
    printf("
    ");
    }
    return 0;
    }
    /*Enter driver details
    driver:1
    NAME :SONU KUMAR
    ROUTE :PATNA TO PUNJAB
    D.L.NO :012457884
    D.O.B :05/08/1998
    DISTANCE :520
    driver:2
    NAME :RAMESH MISHRA
    ROUTE :PUNJAB TO HARYANA
    D.L.NO :012457848
    D.O.B :24/04/2004
    DISTANCE :240
    driver:3
    NAME :PIYUSH KUMAR
    ROUTE :HARYANA TO LUCKNOW
    D.L.NO :0123568995
    D.O.B :12/06/2003
    DISTANCE :540
    ---------------DEATAILS OF DRIVERS---------------
    DRIVER:1
    NAME :SONU KUMAR
    ROUTE :PATNA TO PUNJAB
    D.L.NO :12457884
    D.O.B :05/08/1998
    DISTANCE:520.000000 KMS
    DRIVER:2
    NAME :RAMESH MISHRA
    ROUTE :PUNJAB TO HARYANA
    D.L.NO :12457848
    D.O.B :24/04/2004
    DISTANCE:240.000000 KMS
    DRIVER:3
    NAME :PIYUSH KUMAR
    ROUTE :HARYANA TO LUCKNOW
    D.L.NO :123568995
    D.O.B :12/06/2003
    DISTANCE:540.000000 KMS
    */

    • @A.De997
      @A.De997 Год назад

      details[n] samaj nehi aya. pls bol do

    • @clubsign36
      @clubsign36 Год назад

      @@A.De997 jisse n drivers ke info le sakte hio

    • @clubsign36
      @clubsign36 Год назад

      error ayega, scanf doenst take sapces

  • @shivrajanand2002
    @shivrajanand2002 2 года назад

    i made a function to take user input for driver data. Function takes a struct variable as argument and
    returns nothing i am getting an error that my function works well with one variable d1 and then when it is called by d2 it skips
    one or two printf and scanf. i dont know why. Harry bhaiya please address this problem. @codeWithHarry

  • @valmikbelgaonkar823
    @valmikbelgaonkar823 2 года назад +1

    My code is -
    #include
    #include
    struct Driver
    {
    char name[100];
    long license_num;
    int route;
    int km;
    };
    int main(int argc, char const *argv[])
    {
    int size;
    printf("What is the number of drivers?
    ");
    scanf("%d", &size);
    struct Driver driver_list[size];
    for (int i = 0; i < size; i++)
    {
    printf("Enter the name of driver no.%d
    ", (i+1));
    scanf("%s", driver_list[i].name);
    printf("Enter the license number of driver no.%d
    ", (i+1));
    scanf("%d", &driver_list[i].license_num);
    printf("Enter the route number of driver no.%d
    ", (i+1));
    scanf("%d", &driver_list[i].route);
    printf("Enter the number of kilometres of driver no.%d
    ", (i+1));
    scanf("%d", driver_list[i].km);
    }
    for (int i = 0; i < size; i++)
    {
    printf("Name of driver %d: %s
    ", (i+1), driver_list->name);
    printf("License number of driver %d: %d
    ", (i+1), driver_list[i].license_num);
    printf("Route no. of driver %d: %d
    ", (i+1), driver_list[i].route);
    printf("Number of kilometres of driver %d: %d
    ", (i+1), driver_list[i].km);
    }
    return 0;
    }
    The output I am getting is -
    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.
    Try the new cross-platform PowerShell aka.ms/pscore6
    PS C:\Users\Dell\Desktop\C programming VS code> gcc structure_array.c
    PS C:\Users\Dell\Desktop\C programming VS code> .\a.exe
    What is the number of drivers?
    4
    Enter the name of driver no.1
    Valmik
    Enter the license number of driver no.1
    672
    Enter the route number of driver no.1
    5
    Enter the number of kilometres of driver no.1
    90
    PS C:\Users\Dell\Desktop\C programming VS code>
    Why isn't the program getting run till the end? Please help.

  • @abhaypatel4016
    @abhaypatel4016 2 года назад +1

    #include
    // Using scanf for string because fgets and gets having issue with input lines
    typedef struct Driver {
    char name[40];
    char dlNo[30];
    char route[25];
    int kms;
    } dr;
    int main() {
    int n; /// No. of drivers
    printf("For how many drivers you want to take details
    > ");
    scanf("%d",&n);
    dr s[n];
    //Inputs details
    for (int i=0;i

  • @ommati9563
    @ommati9563 2 года назад +1

    #include
    #include
    struct details {
    char name[50];
    char drivinglic[50];
    char route[50];
    int kms;
    };
    int main()
    {
    typedef struct details dtype;
    int n;
    printf("Enter the numbers of drivers : ");
    scanf("%d", &n);
    printf("
    ");
    dtype a[n];
    for(int i=0; i