Пікірлер
@f4r4g
@f4r4g 4 ай бұрын
It was fun to watch, especially where you made mistakes, thank you for this informative video.
@md.shorifulislamfahim9406
@md.shorifulislamfahim9406 5 ай бұрын
who is here from CS50 ???
@ougininja8412
@ougininja8412 6 ай бұрын
Great explanation
@stantonreddy6276
@stantonreddy6276 6 ай бұрын
@BogdanBudaca i appreciate yr videos, but what set u aside from the others, is the way you explain things, unfortunately in this video, the audio is bad, yes i can see the code, but its missing yr explanation which is the most important part😞
@dasyphan2472
@dasyphan2472 7 ай бұрын
THIS IS WHAT I NEED!! THE PSEUDOCODE IS JUST AWESOME!! THANK YOUUU❤❤
@ngozinoel4024
@ngozinoel4024 9 ай бұрын
I really appreciate
@lilacisblue8300
@lilacisblue8300 Жыл бұрын
This was truly helpful. Thank you so much!
@BogdanBudaca
@BogdanBudaca Жыл бұрын
You're so welcome!
@abuonsumastudios
@abuonsumastudios Жыл бұрын
Great content man... your page deserves more recognition than it has
@guilhermerosa955
@guilhermerosa955 Жыл бұрын
I know that it needs to be like this in order to work, but can someone please explain to me the logic behind why does the divisor int needs to be initially declared as 10 and not 1? In my head it makes sense because if the do-while loop divided the ccnumber for the first time, shouldn't it be 10? Why does it already begin with 100 in the first loop. I know that I'm wrong but I can't wrap my head around why it is wrong lol
@anishacini762
@anishacini762 Жыл бұрын
why don't you just turn your long into a string and use strlen to get the length of your CC number, and then from the math library use pow, to get the first two degits : devide the cc number by 10 to the power of length - 2 ? i wanted to do it this way but i need to use pointers which i don't know how to use properly :')
@BogdanBudaca
@BogdanBudaca Жыл бұрын
Oh that's an interesting solution, cheers
@LouisPinoPercussion
@LouisPinoPercussion Жыл бұрын
Thanks so much!!! I just wanted to point out that you can slightly simplify the addition of the 2 digit numbers by just subtracting 9 rather than using %. Adding digits of 14 is 5, 14-9 is also 5. This works for any number 10-19, then you subtract by 18 for numbers 20-29, 27 for 30-39, 36 for 40-49 and so on.
@BogdanBudaca
@BogdanBudaca Жыл бұрын
Wouldn't this bring on too many 'if's I wonder?
@gardenvariety-
@gardenvariety- Жыл бұрын
another way: #include <cs50.h> #include<stdio.h> #include<math.h> int main(void) { long n; long cardn; int i; int sum1=0; int sum2=0; int lastn; int d; int count; long power; // request the card numner cardn= get_long("What is the card number? " ); printf(" "); n=cardn; while(cardn<10) { cardn=get_long("What is the card number? "); } //Do addition of every other digit starting from the last digit n=cardn; do { lastn=n%10; sum1=sum1+lastn; n=n/100; } while(n>0); //Do addition of every other number starting from the number second to last after multiplying by 2 n=cardn/10; sum2=0; while(n>0) { lastn=n%10; d=lastn*2; if (d>9) { sum2=sum2+d%10+d/10; } else { sum2=sum2+d; } n=n/100; } int f=sum1+sum2; printf("the last digit in the sum is %i ",f); //know the number of digits n=cardn; for (count=0; n>=1; count++) { n=n/10; } printf("Total number of digits %i ", count); power=count-2; //just to know it is working printf("power is %li ", power); //know the first two digits//know invalid card n=cardn; power=count-2; long divisor=pow(10,power); printf("the divisor is %li ",divisor); printf("the remainder after dividing by 10 is %i ",f%10); if(f%10==0) { if (count==15 && (n/divisor==34||n/divisor==37)) { printf("AMEX "); } else if(count==16 && (n/divisor>50 && n/divisor<56)) { printf("MASTERCARD"); } else if((count==13 || count==16 )&& n/divisor/10==4) { printf("VISA "); } else { printf("UNKNOWN "); } } else { printf("INVALID "); } }
@gmfischbach
@gmfischbach Жыл бұрын
Hello, thanks for the video for starters, could i ask you something tho. Before i watched your video i was getting +2 in some of the testing texts of cs50, i had it a little different than you: instead of creating a variable grade an then round it with the index, i had round ( L - S - 15.8). Would you know why that wasnt working ?, it shouldnt it be the same ?
@guilhermefernandes9497
@guilhermefernandes9497 Жыл бұрын
Really good explanation man, keep it up : -)
@babatundekalejaiye7046
@babatundekalejaiye7046 Жыл бұрын
Great Video. I was initially getting a floating point exception error. I Had to change the divisor to a float data type, initialise it to 1 and count to minus 1, and all problems were solved. (c++)
@sophiamarie1656
@sophiamarie1656 Жыл бұрын
Hello everybody, just for future references: While making the cs50 Algorithms problem set, the system showed me an error. This is because the tabulate function is not completely right. I changed the i < candidate_count into j < candidate_count. Then everything worked just fine.
@bhawanthachamod5521
@bhawanthachamod5521 Жыл бұрын
Thanks man, became very helpful.
@youtubejproasters1224
@youtubejproasters1224 Жыл бұрын
so i can follow up the logic behind your notes 100% , but when it goes to apply it to code , i start getting lost after the do while loop , i am full beginner , will it be okay to skip this problem till i reach better knowledge ? Or it will impact my studies further if i cant solve it and understand the mechanism after the do while loop in my mind ..
@BogdanBudaca
@BogdanBudaca Жыл бұрын
I would say my advice is to try some more, it's normal for things to take a while until they fall into place
@_Silviu
@_Silviu Жыл бұрын
Plâng de 2 zile la problema asta😂 Sper că e cea mai grea de la CS50, fiindca altfel îl termin la anul😜 Dacă nu reușesc pana la finalul săptămânii, revin😁
@BogdanBudaca
@BogdanBudaca Жыл бұрын
Da, a fost f dificila si pt mine, inca ma bantuie 😆
@twopaypal_f1
@twopaypal_f1 Жыл бұрын
just finished this problem all on my own. first time coding. so fucking proud of myself. your code is way cleaner than mine, but i'm still happy i was able to get everything to work and all the green smiley faces. keep the faith guys. you can do this even if you've never coded before. just don't give up.
@NikolasMihalopoulos
@NikolasMihalopoulos 2 жыл бұрын
ive followed all the steps but for some reason when type my number then press enter it just goes down a line and doesnt say invalid or anything
@juniors3275
@juniors3275 2 жыл бұрын
After watching the highest viewed videos @8:29 this guy is literally the only person on youtube that i watched who explained this section as if you were a student and didn't assume you know every single detail and process. well done and god bless you, i am now subscribed!!!
@raneemyanes3468
@raneemyanes3468 2 жыл бұрын
thank you 🥰
@bigk9000
@bigk9000 2 жыл бұрын
I'm still trying to wrap my head around contract testing. What's different between this with Pact and integration tests with Mock Service Worker?
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
I think the gist of Pact is having a contract in place and knowing as soon as something changes and it breaks, and also serve as an indication of what's expected.
@sandamn85
@sandamn85 2 жыл бұрын
Hi there, "public class Main { " can result in compiler error, for the purposes of this tutorial, leave out "public" and your code should run.
@abirsonet925
@abirsonet925 2 жыл бұрын
nice, really helpful
@victorgarciarubio7284
@victorgarciarubio7284 2 жыл бұрын
Amazing tutorial, just what I was looking for!❤
@lukasz070485
@lukasz070485 2 жыл бұрын
Hi Bogdan, thank you for the video. I am having the problem understanding the logic in around 23 min. For loop is quite complicated, why -2 and how is that divisor work ?? thx in advance
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
Hey, Lukasz, maybe it might help if you come at it from trying to get the first digit of the number? This was one approach (maybe a bit weird I agree), for example start the divisor from 10, if you have 12345 - so length 5, if you start from 0 and up to 5 - 2, you get three iterations of 10 * 10 -> 10000, so 12345 / 10000 will give you the first digit.
@matheusrocha8037
@matheusrocha8037 2 жыл бұрын
Tanks for helping
@itsacademytime9775
@itsacademytime9775 2 жыл бұрын
I need this in python
@thecryptographer55
@thecryptographer55 2 жыл бұрын
2:43 second step : I think in doubling must starting with 4 not 1 ??
@UGH_ZEREF3431
@UGH_ZEREF3431 2 жыл бұрын
thank you sir
@osmanyobregon805
@osmanyobregon805 2 жыл бұрын
Muy buena tu forma de explicar,no entiendo como alguien tan genial tiene tan poco reconocimiento,te deseo éxitos y muchas gracias por la explicación :)
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
Gracias
@boluemmanuel8999
@boluemmanuel8999 2 жыл бұрын
Thank you so much you explained really well and detailed 👍🏽
@smarterthinks
@smarterthinks 2 жыл бұрын
bro do we get fake cc
@ChristmasSpirit23
@ChristmasSpirit23 2 жыл бұрын
De la ce vârstă ai început să programezi?
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
30
@agutanful
@agutanful 2 жыл бұрын
Thank you so much! I was able to complete the task thanks to your initial explanation.
@daniruzsa1751
@daniruzsa1751 2 жыл бұрын
It s pretty nice to see someone experienced does it :D i managged to complate is in 3hour without help Just started cs50
@naveenthayyil8768
@naveenthayyil8768 2 жыл бұрын
legend
@Girlwithherownwings
@Girlwithherownwings 2 жыл бұрын
Can you share the report pdf of this
@yousefali652
@yousefali652 2 жыл бұрын
why we use return 1 ????????????
@sanketgoti
@sanketgoti 2 жыл бұрын
Great👍
@VinnieMarchisio
@VinnieMarchisio 2 жыл бұрын
I really love the way you explain your logic, and then don't assume it is obvious. I like how you hope we were able to follow along instead. You seem like a genuinely nice guy. Thanks, Bogdan.
@juniors3275
@juniors3275 2 жыл бұрын
honestly!!! best explanation i've seen. ppl explain things on youtube and assume you know everything, dude if i knew everything why would i need an explanation?
@ammanchhetri6716
@ammanchhetri6716 2 жыл бұрын
Very good explanation 👌..thank u very much ... 🙂
@aiden4609
@aiden4609 2 жыл бұрын
ρгό𝔪σŞm
@VinnieMarchisio
@VinnieMarchisio 2 жыл бұрын
I really appreciate the way you went through the problem. It was by far the easiest video for me to follow and understand the logic. Thank you for sharing it with us.
@2snish
@2snish 2 жыл бұрын
Thank you this helped me better understand the problem !
@MagdaleneAlchemist
@MagdaleneAlchemist 2 жыл бұрын
Darling, i've walked to Mordor and beyond trying to find something like this! Thank you! this is just what i needed!
@alibe4582
@alibe4582 2 жыл бұрын
please in this part // check validity of the key for (int i = 0; i < strlen(argv[1]); i++) { if (isdigit(argv[1][i])) { valid_key = true; he gives [Error] Initial 'for' loop declarations are only allowed in C99 or C11 mode
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
Hey there, please google your error, stackoverflow should be the first result, with a fix 🤙
@karthikeyan.ganapathy
@karthikeyan.ganapathy 2 жыл бұрын
Thanks for the good explanation and documentations
@BogdanBudaca
@BogdanBudaca 2 жыл бұрын
Cheers