#CS50 Credit Problem

1 messages ยท Page 1 of 1 (latest)

raven rivetBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

quasi umbra
#

i cant use other libraries besides those 2 included i believe

#

luhns algorithm takes second to last number and every other number after that, to multiply by 2 and add the numbers (12 = 1+2) together
and then add the other previously skipped numbers to the sum of the first result and checks if the last number is 0

noble rock
#

Have you ever written any C program before?
Because from looking at your code it appears as if you've never even seen a "Hello World" program

#

I mean, there's so much wrong that I don't even know where to start

quasi umbra
#

i just started C yesterday :/

noble rock
#

How are you learning C?

quasi umbra
quasi umbra
noble rock
#

What is that?

quasi umbra
#

its the online program from harvard

noble rock
#

ah i see.
lemme quickly check what we recommend, I think CS50 is also part of it

#

!howto learn-c

raven rivetBOT
# noble rock !howto learn-c
How to Learn C Programming

We generally recommend a good book to learn the necessary fundamentals:

To actually write and run C code, you will need a compiler, editor, and debugger. We strongly recommend to start out using an IDE, which will provide all these tools for you:

<:microsoft:1165512917047853127> Windows
  • [Visual Studio](#1165492293810257920 message)
  • CLion
<:tux:1165505626894520361> Linux
<:apple:1165508607798943754> Mac
Words of Advice

The wise programmer is told about the debugger and uses it.
The average programmer is told about the debugger and avoids it.
The foolish programmer is told about the debugger and laughs at it.

quasi umbra
#

yea lol

noble rock
#

Okay, so that VISA card number validator is like your second or third homework?

quasi umbra
#

yea

#

third

noble rock
quasi umbra
#

i just need help on building a mindset for how to approach the problem

#

well first could u tell me what is so wrong about my code ๐Ÿ˜…

noble rock
#

oh and for the printf("%s\n", type) the datatypes don't even match (i.e. %s is incorrect for long).

Oh, and you redeclare number in your main function, thereby shadowing the global number.
And I also missed a few other useless semicolons

You see how it's a mess to try and explain that?

#

Right now for me it's like trying to explain you how to build a house, but you can't even stack bricks onto each other

#

Please thoroughly re-read your study materials and go over all the past exercises

quasi umbra
# noble rock

ah i see what you mean
but i was hoping you would understand what im trying to do, im more just typing down useful in the area im going to use it like for the (number/10)%10
just like type it down, worry about syntax later

#

but yea the useless semi colons are on me ๐Ÿ˜…
also the global variable i thought i would need to declare it before using the variable in the functions above main

raven rivetBOT
#

@quasi umbra

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

quasi umbra
#

!solved