PROBLEM SET 1: CREDIT | SOLUTION (CS50)

preview_player
Показать описание


––– DISCLAIMER –––

The following videos are for educational purposes only. Cheating or any other activities are highly discouraged!! Using another person’s code breaks the academic honesty guidelines. This solution is for those who have finished the problem sets and want to watch for educational purposes, learning experience, and exploring alternative ways to approach problems and is NOT meant for those actively doing the problem sets. All problem sets presented in this video are owned by Harvard University.

–––
Рекомендации по теме
Комментарии
Автор

honestly still trying to figure out how week1 lecture talks about printing "meow" 3 times but the pset involves writing code to break down credit card

joshjohnsonaudio
Автор

Best explanation so far!
Other videos are givin too many things for granted, but if I had this understanding of the matter I would never had the need of a video.

Thanks!

paolobietolini
Автор

I just started with programming this week and I decided to use cs50 to get started. I got this problem solved without any help but I knew that there must be a more efficient way. They way I did it was writing a function to isolate each individual digit and put it into another function to assign each individual digit to an individual char (a - p). Performing the buhl check with the variables and to then return a checkdigit to main and print the corresponding creditcard company or "invalid"..As you can imagine my code is mutch longer than yours. So I will try your approach now.

tobib
Автор

Very helpful for me to resolve a few obstacles with this code.
Still one big confusion: Why does the "card_num" go after the "long" in the function parameters? (ex., "bool is_card_valid(long card_num)"). In the main function you already give the function (ie., "is_card_valid") card-num as a argument, so why would it need to go in the function parameter itself? It seems redundant, but my code didn't work without it so obviously it's not.

christianbutcher
Автор

I was stuck in the part of doing the sum of the products, specific for the two digit numbers. Your video helped me with that, so thanks!
One thing we (cs50 students) need to make sure is not giving up in the first hours or days! If you're stuck just let a day or two pass, you will eventually find or think about a solution yourself. It took me almost 4 days to come up with a solution for this ...

lucaslima
Автор

mate can you tell me what is the syntax printcardflag why not printf

chitrakchakraborty
Автор

Thank you for explanation I want to see the rest of your code

khaledahmedabd-elraoofemam
Автор

dude use dark mode !! that sets the mood for some good coding !!

karanmundhada
Автор

Dear god, and that's only week one! hahahah

marciofilho
Автор

this is the least beginner friendly coding course ever.. lol

JayBel