First of all, there is no get_long_long in the cs50.h library.
Secondly, this is a clunky way to limit your input that most probably is causing some of your issues.
A more elegant way is to use the while loop to make sure it is a positive input and then calculate the length of your number by using a remainder.
number = get_long("What is your credit card number? ");
while (number < 0);
int count = 0;
while (number != 0)
number /= 10;
Count will now detect the length of your cc number and you can evaluate wether it is a Visa, Mastercard, Amex or invalid input via a simple if check.
Just make sure to create a duplicate (buffer) of your cc number so you don't loose the original input.