How come long long cannot handle this input? Further how is the arbitrary output computed?
What is the appropriate relational operator for <>
a.k.a. within or between two values i.e. I am looking to only accept a valid credit card number while credit cards have a maximum of 19 and minimum of 13 digits.
Any comments on whether I am heading in the right direction and or guidance for the next step?
~/Dropbox/cs50/pset/1$ clang-3.5 credit.c -lcs50 -o credit;./credit
Please enter your name: ss
Hello ss, Please enter your credit card number: 6666663333444
Your credit card number: 874090052
#include <cs50.h>
#include "stdio.h"
// Prototypes
int GetPositiveInt();
// Global variables
//string S;
int main(void)
{
//string s = "Kevin";
printf("Please enter your name: "); //\n");
string S = GetString();
//printf("You have a %s credit card.", CC_BRAND);
printf("Hello %s, Please enter your credit card number: ", S);
long long CC_NUM = GetPositiveInt();
printf("Your credit card number: %lli\n", CC_NUM);
}
int GetPositiveInt(long long CC_NUM)
{
//long long CC_NUM;
//string S;
do
{
CC_NUM = GetLongLong();
}
while (CC_NUM <= 19 && CC_NUM >= 13);
return CC_NUM;
}