CS50 Mario SOLUTION - Problem Set 1 | Explanation and CODE

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • We talk about cs50 pset 1 ( cs50 Problem Set 1 ) cs50 Mario less comfortable solution and Line By Line cs50 Walkthrough.
    Disclaimer:
    This video is for educational purpose only and is TRANSFORMATIVE in nature.
    Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use.

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

  • @samuelfey4924
    @samuelfey4924 4 года назад +209

    men I couldve never done this . and I studied really well , I cant imagine the pressure of harvard students who learn all that in just a week

    • @DeliberateThink
      @DeliberateThink  4 года назад +6

      True!

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

      I learned it in one day

    • @pauldank3453
      @pauldank3453 3 года назад +86

      @@karanmaheshwari2123 ok

    • @montyl3557
      @montyl3557 3 года назад +31

      They're probably full time students, so add in the time they'd lose if they were working. Also, they were allowed to work on this with others just as we are. When we put multiple brains together things become easier to accomplish. Oh and being good at math helps, people who aren't decent with arithmetic and algebra don't typically go into computer science. So what i'm getting at is, ivy league schools may be prestigious, but you're paying for names and political connections when you get into one. Don't count your brain out just because you're not there.

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

      A week is really long, I watched the lecture, did the lab and the two pset in one day

  • @A.M.adventuring
    @A.M.adventuring 4 года назад +78

    I was stuck on this for what felt like forever! Thank you!

  • @ezra136
    @ezra136 3 года назад +18

    I really do appreciate you taking out the time to complete this for all of us

  • @omen149
    @omen149 3 года назад +11

    the amount of time that this took me to really understand it just make me feel bad tbh
    u r a beast dude

  • @OliMe318
    @OliMe318 4 года назад +29

    Thank you. I learned from your code. I was really struggling with the end. I watched you video from 2017 then came to this one and it finally clicked in my head. I'm a beginner at this. So learning is more important than just getting the answer. Thanks so much.

  • @farea4649
    @farea4649 4 года назад +36

    Thank you so much for your help!! I really appreciate you taking the time to show us how its done!

  • @jirodfgradediscipline9407
    @jirodfgradediscipline9407 4 года назад +18

    Hi, this is so good and precise.
    Everyone should try to watch the video multiple times. It is extremely concise.
    And that's a good thing!

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      Wow, thank you!
      Glad you enjoyed it!
      Glad it was helpful!

  • @praneelbhatnagar2333
    @praneelbhatnagar2333 4 года назад +16

    I don't really get the part of why (i + j < n -1) part, can u explain further? Please help. Any help would be appreciated. Great video btw.

  • @vontel2701
    @vontel2701 4 года назад +9

    I noticed your second video you uploaded about this and honestly what is confusing me is the math equation using int. The new video made it a little bit easier to understand but the drawings of the grid was so hard to read it also made it difficult to follow along with the mathematical mindset you have solving this . I know it would be tedious to make a 3rd video about this problem set but honestly kinda need it. Thank you for making this and other videos to help people like me out!

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

      Ok gonna make a detailed explanation video.

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

      This was initially confusing me even after watching your video until I used debug50 ./mario. It will let you watch how your code runs line by line. What was confusing to me is how for loop within for loop interacts. In the video, i + j < n - 1 was given but I had no idea how that was true. My first thought was i + j in first loop should return 0 + 0, then 1 + 1, 2 + 2, and so forth. But what happens is that the for loop within the for loop should return 0 - 7 first before the main for loop should return 1. So it should be like, 0 + 0, 1 + 0, 2 + 0, 3 + 0... 7 + 0 THEN MAIN LOOP STARTS. 0 + 1, 1+ 1, 2+ 1, 3 + 1, 4 + 1... 7+ 1, MAIN LOOP AGAIN. 0 + 2.. etc After only that did the formula given made sense to me. Hope this helps everyone who's having the same trouble as I had

  • @82sjmc
    @82sjmc 4 года назад +7

    thank you brother, i have been racking my brain on this problem for 10 hours

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

      Glad it helped! And it's not unusual to be stuck on the problem set for 20 hours. Keep at it!

  • @tatyanagurilyova2652
    @tatyanagurilyova2652 3 года назад +7

    Thank you for the video! It helped a lot. I've been trying for two weeks before today. You made my life easier!

  • @joshua8219
    @joshua8219 4 года назад +20

    From: Hi my name is Dave.
    To: THIS?!

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

      0 to 100 real quick! 😂

  • @jefferylara7679
    @jefferylara7679 4 года назад +33

    i dont get the so called "pattern" of what you were saying of how the hashes worked :( and I agree with most of the comments here how the hell are we going to make these jumps when I just barely learned that you can print spaces by just leaving a space in the printf space :(

    • @DeliberateThink
      @DeliberateThink  4 года назад +6

      Yeah. I know its hard.
      Made a new video called cs50 mario detailed explanation.
      Do check it out.

  • @desolate358
    @desolate358 4 года назад +6

    Thank you, watching your video helped me see where I made a mistake in my code.

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

    you are an excellent teacher and communicator, thanks for the awesome videos!

  • @jameschen4465
    @jameschen4465 4 года назад +5

    I don't really get the part of why (i + j < n -1) part, can u explain further?

  • @MOMON2006
    @MOMON2006 4 года назад +5

    I was stuck on this for decades!!

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

    Can someone help explain the If (I + j < n - 1)? How do we naturally come to that conclusion?

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      Sure.
      The I + j thing is just a pattern I observed. (btw it's not natural...I had to think hard for some time)

    • @jask6125
      @jask6125 4 года назад +9

      Copied and pasted from someone who helped me: He is counting how many loops have passed.
      Take a look at the result with the stars
      i+j < n - 1 let's assume n = 4
      first loop first line: 0+0 < 3 prints("_")
      2nd loop first line: 0+1 < 3prints("_")
      3rd loop first line: 0+2

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

      @@jask6125 Thanks for explaining it in more detail!

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      Gonna make a more detailed video!

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

      @@jask6125 someone who came up with this on their own is a genius or I'm just really really dumb. Lol

  • @MostafaMahmoud-111
    @MostafaMahmoud-111 4 года назад +8

    Thank you
    you made me understand how to solve this problem but at first solution you put the equation without explaining how you figure out it.
    any way good job

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

      I didn't understand as well where did he take that i+j...

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

      Thanks for the feedback!

    • @jask6125
      @jask6125 4 года назад +1

      @@Jupura2810 He is counting how many loops have passed.
      Take a look at the result with the stars
      i+j < n - 1 let's assume n = 4
      first loop first line: 0+0 < 3 prints("_")
      2nd loop first line: 0+1 < 3prints("_")
      3rd loop first line: 0+2

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

      He is counting how many loops have passed.
      Take a look at the result with the stars
      i+j < n - 1 let's assume n = 4
      first loop first line: 0+0 < 3 prints("_")
      2nd loop first line: 0+1 < 3prints("_")
      3rd loop first line: 0+2

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

      @@jask6125 Thanks for the detailed explanation!

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

    Thank you so much this was very helpful and I feel like I was able to understand how this works!

  • @shandhinik9077
    @shandhinik9077 4 года назад +6

    best ever explanation

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

    Thanks for the help. My question to help get some clarity is, what exactly do the integers j and I correspond to in the output? I feel this is essential to understand

    • @DeliberateThink
      @DeliberateThink  4 года назад +9

      Yes, sure.
      Here i symbolises the current row number, where row numbers start from 0 to n - 1, and j represents the column number.
      The I + j thing is just a pattern I observed.

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

      @@DeliberateThink very very helpful! I appreciate it very much! Thanks

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

    Could you please explain the if statement, if (i + j < n - 1)? I don't understand what the i and j represent. Would be much appreciated

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      Sure.
      The i + j thing is just a pattern I observed. (btw it's not natural...I had to think hard for some time)

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

      copied and pasted from someone who helped me
      He is counting how many loops have passed.
      Take a look at the result with the stars
      i+j < n - 1 let's assume n = 4
      first loop first line: 0+0 < 3 prints("_")
      2nd loop first line: 0+1 < 3prints("_")
      3rd loop first line: 0+2

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

      @@jask6125 Thank you!!

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

    Thank you I was really confused until I watched your video

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

    você é sensacional!

  • @dancingviolinist
    @dancingviolinist 4 года назад +5

    Thank you so much. I understand much BETTER, but I still don't understand how i knows that it is blank spaces and j knows that it is #. Where do we establish that in the code? Also, I want to understand why (i + j) works. I'd think that if i is going up by one then j would be going down by one, so how does it work with them BOTH going up by one?

    • @nonenone2669
      @nonenone2669 2 года назад +19

      I know this comment is 1 yr old, so you may have figured this out already, but..
      I'm not sure if this answers your question, but "j" doesn't know its a # nor does "i" know its a blank space..
      "j" *AND* "i" will BOTH give you a # symbol *or* a space.
      Its the reason why "(i+j)

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

    Man, thank you so much for your tutorial!

  • @marai-ken309
    @marai-ken309 4 года назад +2

    Thank you very much for the guide!

  • @days_with_yaras
    @days_with_yaras 4 года назад +1

    Omg it worked this time.. and I understood ...TYSM A LOTTTTTTTT.....well...hv to say, the best part was every time saying 'Ooppps' for getting a bug xD adorbs UwU

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

    Extremely helpful!!!

  • @charlierichardson1520
    @charlierichardson1520 4 года назад +6

    What does the j do again?
    Amazing video btw, really well explained 👏

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      j corresponds to the column number,
      Thanks

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

      @@DeliberateThink How did you make j correspond to the collumn and i to the height?

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

    you saved mi life. thank you

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

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

    this is so helpful. I have been staring at the exercise for nearly a week and wanting to give up, then stumbled upon your video. Thank you so much! You are a heaven sent! Could I just ask please, what's "i" and "j"? Why did you use them, not any other letters? Thank you for your answer.

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

    thanx bro, that was really helpful

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

    This was really helpful.

  • @Lara-fg9vq
    @Lara-fg9vq 4 года назад +2

    Thank you so much for this!

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

    Very helpful, but at 5:50 I think you mean to say "When j is..." (not i, as i is used for the rows, j for the characters).

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      Yes, you are right I should have said j since j is used for characters!
      Thanks for the feedback!

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

    I would have NEVER been able to figure out that equation for the if statement. That part got me. :( Anyone have tips on that?

  • @filippoiguera3224
    @filippoiguera3224 4 года назад +5

    Please upload others problem if you can ;)

  • @valeriadeiloff7850
    @valeriadeiloff7850 4 года назад +1

    Hi! First of all, thank you so much for this video! I was about to cry haha. Anyway, what does the last printf("
    "); mean? Once again, thank you so much!

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

      It is like if you pressed enter after each line of hashes

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

    ok so i understand how this works but I dont think I ever would have come to this solution on my own. Wondering if I should even continue with the course if the first week confused me so much

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      Don't give up. It took me a long time to come up with such solutions and I am still improving.

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

      Did you keep going bro? I'm in the exact same situation

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

    amazing, subscribed

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

    thanks bro, from argentina

  • @codedog2126
    @codedog2126 4 года назад +1

    This worked swimmingly. Keep up the good work, bruv.

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

    Thanks for this

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

    Finally I thought the Indian guy on RUclips was gone, thank you my lord

  • @khudairahmed290
    @khudairahmed290 4 года назад +1

    its very help full thanks
    Deliberate Think

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

    well done

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

    This helped a lot! Cheers!

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

    Thank you!!!

  • @elfullin
    @elfullin 4 года назад +6

    I'm not understanding the connection between the while loop, and the int in the for loop.
    So, from the start, essentially you;
    1. stated there will be an variable int named n.
    2. did a user input in order to give n an actual int value.
    3. created a forever loop which would repeat the previous user input prompt, until n was greater than or equal to 1, and less than or equal to 8.
    4. if the user gave you a 0, that's less than 1 so it would ask again, if they gave you an 9 that would be greater than 8 so it would ask again.
    after this is where I get confused...
    you created a for loop in order to... what exactly. I understand that within it you're converting an answer within the parameters from the previous prompt into a repeated sequence of that answer but turned into "#"'s. How is that doing that?
    Let me take a stab at it and type it.
    for (int i = 0; i < n; i++);
    this is basically saying, an integer " i " will start at 0, and it will repeat itself PLUS 1, until it is less than n, which by this time would be an answer that is within the parameters stated above the code. if 1 was given, the for loop will end up with "one repeat" because it takes one to go from 0 to one. and you also made it print # for every repeat. I think I kind of get it now lol
    after that I have no idea...

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      The outer loop is the number of repetitions, as you mentioned.
      The inner loop is for printing the individual characters.
      The i + j thing is just a pattern I observed. (btw this is not something that comes naturally...I had to think hard for some time!)

  • @someone09090
    @someone09090 4 года назад +1

    Thanks a million

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

    Great explanation.. What is first method called..?

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

      As far as I know I don't think there is any name to it. It's just a pattern I observed.

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

    Did you ever had the problem of skipping odd numbers?? Mine works really well until an odd number comes along, it reacts as if it were a number out of range, it's really frustrating

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

      hmmm...that's strange

    • @marianacruz5616
      @marianacruz5616 4 года назад +1

      Oh no... even you think it’s strange... I’m doomed

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      @@marianacruz5616 Hey, please don't lose hope...I was in the same position when I started...shoot me an email...I'll sort it out.

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

      Deliberate Think thank you so much! I decided to rewrite my code in a new tab and IT WORKED!
      I must have misplaced this little detail (maybe a bracket) because I still can’t figure out what happened...

  • @krisbadiola1902
    @krisbadiola1902 4 года назад +1

    Youre the best!

  • @thelyadanar
    @thelyadanar 3 года назад +5

    Hi! I am stuck on this and this video really explained very well. But I still don't know know how to get to think of (n-1) :((

    • @nonenone2669
      @nonenone2669 2 года назад +12

      Did you figure this out?
      You have to look closely at the results of (i+j)..
      Lets say n= 3..
      Look at the results of i+j closely and think "how can i make it so that certain answers of i+j give me spaces?" Then your first thought might be "if anything is less than "n", or in this case, 3, then they make spaces, but wait that doesn't work" then you look at the answers again and see that if you say "if the answers of i+j are less than 2, then that will work, but how will 2 work for every int "n"?" Then u think "i can make 3"n"-1 to give me 2" thus n-1 is thought about.
      I know that might not help, but that was my thought process...
      Also, it helps to write out and label how every step is executed like a debugger will show you every step in every line.
      Draw it out in a paper.
      I think this is the biggest tip to take away. Thats to know how every line is being executed, and being able to draw them out and label the results with the initialized ints like "i" and "j".
      Heres another explanation that i wrote in another comment that may or may not be helpful of how i drew this code out on some paper, and how i labeled things:
      "I know this comment is 1 yr old, so you may have figured this out already, but..
      I'm not sure if this answers your question, but "j" doesn't know its a # nor does "i" know its a blank space..
      "j" *AND* "i" will BOTH give you a # symbol *or* a space.
      Its the reason why "(i+j)

    • @nonenone2669
      @nonenone2669 2 года назад +5

      Additional tip to get your mind to be more sharp:
      Eat healthy, exercise, and sleep 8 hours.
      It sounds silly, but its proven to make your mind sharper, so take care of your body and your brain will benefit you with its sharp thinking.

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

    Great vdo 👍👍

  • @sran41
    @sran41 4 года назад +1

    Thanks dude!

  • @MostafaMahmoud-111
    @MostafaMahmoud-111 4 года назад +5

    Hey brother
    in second method i made the code with out last printf("
    "); and it worked correctly and i test it too and no error

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

    Hi there - why would my pyramid be left-aligned and I literally followed your code exactly and yours is right-aligned? Please can you help me get it to be right-aligned

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

      watch the new video ruclips.net/video/MAiNeyJ6ROI/видео.html

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

    thank you from turkey

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

    Why when I do this are all my #'s starting from the left side and not the right-hand side like they are requesting?

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

      watch the new video. if you still find it confusing drop me a mail.

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

    I gave up on doing this with C and instead coded it successfully with python lmao!

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

      python is way smoother than c, but c has got a couple of tricks up its sleeve.

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

    When I enter ./mario I always get no file or directory, this is what made me look up a video tutorial in the first place but I still have this problem? any ideas?

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

      no idea

    • @jjulian1023
      @jjulian1023 4 года назад +5

      you make sure you are in the mario folder
      try cd ~/pset1/mario and then hit make mario and then ./mario

  • @Betwazzled
    @Betwazzled 4 года назад +1

    Hi dude. Could you make a new video for the more comfortable mario? in the old ones the music is so loud I can't hear you speak and your other video on it doesn't really explain things, just sort of alters some things and comments are turned off.

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

    Thank you

  • @asoseiji
    @asoseiji 4 года назад +1

    Could you please explain how the computer understand that i is equal to number of lines and j is equal to number of characters?

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      i and j are just conventions...you can name the variables anything you want...you can say int row = 0; row < n; row++.
      Great Question!

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

      @@DeliberateThink Thank you! So does it mean that in this case rows and characters are the variables by default? So no matter what names you give the variables, the computer treat that two variables as rows and characters?

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

      @@asoseiji yes according to the way print functions work, you can only print a row and cannot go back up to a row...unless u use other fancy tricks

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

      @@DeliberateThink Ok got it. Thank you so much! That was so helpful!

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

    I got close ....tried to create a user defined function and proceeded accordingly.

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

    at 2:20 why do we suddenly use the letter i? and what does it represent?

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

    thanks mate:)

  • @АлександраК-к2ю
    @АлександраК-к2ю 3 года назад

    OK stupid question, because it's my first day of ever using C.
    When you use printf("
    ") in the end of the code, how does it know to make a new line after every 8 hashes and not just one new line after all of 64 of them?

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

      Because of how the "for" loops are executed.
      Step 1: the outer "for" loop will be executed.
      Step 2: the conditions will be checked in the outer "for" loop.
      Is "i" less than "n"? If yes, then the program will now go into the inner loop (it wont execute i++, yet)
      Step 3: Now the inner "for" loop will be executed.
      Step 4:
      It will check the condition, is "j" less than "n"? If yes, printf("#")
      Step 5: Then the inner "for" loop will perform (i++) and check the condition again in the inner "for" loop.
      If "j" is still less than "n", then printf("#").
      Next, perform i++
      Step 6: Once the inner loop can no longer be executed (that happens when "j" is no longer less than "n"), the program gets out of the inner loop (after "n" hits 8 loops), and then it goes to printf("/n")
      That's how you get the second row.
      When "j" is no longer less than "n", the program will go to perform "/n". Thus creating the second row.
      And then after you go to the second row
      The program goes back to step (1) and repeats the whole process until the outer "for" loop's condition is false.
      That means until "i" is no longer less than "n"

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

    I feel so stupid I can’t believe I didn’t think to use an If Else conditional!

  • @sonamsherpa2779
    @sonamsherpa2779 4 года назад +1

    What is does the variables i and j represent?

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

      Here i represents the current row number, where row numbers start from 0 to n - 1, and j represents the column number.

  • @1biutza
    @1biutza 4 года назад +2

    How much time did it take to come up with this solution? I tried drawing the columns and rows with numbers and letters 100 times and didn't see it. I guess it's easier to imagine what would happen after every loop is executed and what to change for it to execute like you want it to?

    • @DeliberateThink
      @DeliberateThink  4 года назад +5

      Hi, Maria...I don't remember...and it doesn't matter how long it takes...its how much you learn.

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

    Just would like to know the difference.
    Why start with
    int main(void) instead of int main ( ) ?

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

      you got to put void in those brackets to tell c that no there is no ouput

    • @NoSe-rr1gv
      @NoSe-rr1gv 4 года назад

      Both work the same way, its just a way to make code more clear

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

    How are you doing this?😭😭
    I don't understand how you just know what to do

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

    Sir what happened, why you are not uploading another solutions videos?

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

    How would you add the right side of the pyramid with the if, else method you used for the code?

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      by finding another pattern

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

      Deliberate Think well I used another for code loop but just had it be right aligned by using printf(“ “); ?

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

    I feel dumb

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

    I worked it out but I did something weird (no idea what i did just from messing around) I did a for loop containing a further 2 x for loops.
    {
    int i = get_positive_int("Height: ");
    for (int j = 0; j < i; j++)
    {
    for (int k = 0; k < 7-j; k++)
    {
    printf(" ");
    }
    for (int l = 0; l < j+1; l++)
    {
    printf("#");
    }
    printf("
    ");
    }
    }
    And wahla it worked! but although it did as stated. I guess the code wasn't correct it didn't pass check50. So alas I ended up here! really thought i'd cracked it!!!

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

    great video! Quick question how come when I type ./mario it says height: then after I input a correct height the program ends
    example:
    height: 8
    ~/pset1/mario/ $

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

      it just restarts without taking the printf#

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

      you probably wrote n + 1 not n - 1

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

    I guess line 16 (at 11:00) is wrong. it should be for (int j = n - i - 1; ........

  • @pexma
    @pexma 4 года назад +1

    is it uploaded already?

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

    Is this hard or am I an idiot?

  • @aizhouliu4010
    @aizhouliu4010 4 года назад +1

    what do the i and j mean?

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

      Copying from a comment.
      He is counting how many loops have passed.
      Take a look at the result with the stars
      i+j < n - 1 let's assume n = 4
      first loop first line: 0+0 < 3 prints("_")
      2nd loop first line: 0+1 < 3prints("_")
      3rd loop first line: 0+2

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

    (@1:05)
    why is introducing int n before the do-while loop important? Why can't we introduce it in the loop itself?
    this is really helpful though!

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

      I could be wrong about this, I'm a beginner as well and can't even really do this problem by myself but I think it's so that the integer is not introduced repeatedly. I think it would still work but it wouldn't be as optimal because the loop is constantly reintroducing that variable.

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

    what does printf(" ") do??

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

      It puts a space on each line as you can see when it prints half of the pyramid.

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

    Can you help me, I cannot perform check50

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

    what does int j mean?

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

    #
    ###
    #####
    #######

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      ...hmm

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

      @@DeliberateThink
      I was stuck on how to reflex the pyramid. At first I was able to do the left-aligned pyramid then tried in many ways to do the right-aligned but the closest thing I could get was making it upside down then I gave-up and found your video and edited my code to look like yours but I forgot to change this line " for (int j = 0; j < i; j++)" into this line "for (int j = 0; j < n; j++)" and the result was this:
      #
      #####
      ######
      #########

  • @bintangantares2439
    @bintangantares2439 4 года назад +1

    ggwp

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

    I typed in the do and while loop but every time I go down to the terminal and type “make Mario” I keep getting the error message: “***No rule to make target ‘mario’. Stop”. I am not sure what I am typing wrong. I copied the way you typed things to a tee.

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

    where are the rest of the problems

    • @DeliberateThink
      @DeliberateThink  4 года назад +1

      I'll upload them in a couple of days. Thanks for your patience!

    • @filippoiguera3224
      @filippoiguera3224 4 года назад +1

      @@DeliberateThink all of them? From week 1 to week8? It would great man! Really!!

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

      @@filippoiguera3224 Will Try

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

      @@filippoiguera3224 He's making new videos!!!

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

    I think the root of my misunderstanding is this question: how does the second for loop symbolized by j create a row?

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

      for each i the inner loop executes n times, creating a row

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

      @@DeliberateThink Thanks for the response and all your time you are putting into helping us! is there a way I can slow down the execution of the code so I can see each character print at a time?

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

    I was able to do the harder Mario in 4-5 days, that was really hard, but what give me trouble was the Credit, MAN that was so hard that i take 1 week and can't do, but then i stop for 2-3 mouth's and when i come back i see that i have lost my last code so i was forced to do all again, and that was really good, because doing all again, that time i make the code more eassily and in only 2 days i finished the code (Sorry the bad english)

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

    Thank you so much man!

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

    Thank you!

  • @norlha04
    @norlha04 4 года назад +1

    How do you clear the terminal? It won't even let me delete once I've typed something:(