Hey Guys,
I am a business major with a twisted sense of having "fun". I
decided that I wanted to learn c (not c++) programming for just the
"fun" it. So, I'm new...and I'm stuck lol. I'm trying to validate a
credit card number using my code. The first thing that I'm trying to
do is isolate certain digits from the string of 16 or 15 digit credit
card numbers entered by the user. I've been able to figure out how to
do this if I provide the number; but can't figure out how to do it as
a scanf (so the user can provide the number). I know there is a lot
more code after i isolate, but I'm fairly confident I can figure that
part out. I just can't get the isolating digits part. I wrote this out
to show how I have isolated using my own static input....how to i turn
this into the user giving me the number?
Code:
#include <stdio.h>
int main()
{
char number[16] = "123456789112345";
printf("%c\n", number [10]);
}
what I want to do is replace my static "123456789112345" with
something the user provides through a scanf; but I need to still be
able to isolate certain digits.....say for instance multiplying every other digit by 2.
Any suggestions?
Thanks in advance!
Juan