Questions tagged [pset1-credit]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

segmentation fault when i compile my program

int main(void) { long long cardnumber = 0, calc; //string credit[1]; //string lengthkey[1]; string credit[1]; string lengthkey[1]; int countcardcharacters = 0; //user ...
0
votes
1answer
34 views

How do you find the first digit of a long number?

I wrote the following code to try to find the first digit of a long number (this is for the CS50x "Credit" exercise), but it's not working. Any tips? // Conditions and relational operators #...
0
votes
1answer
30 views

Stuck with pset1 credit question. I don't know why I'm not able to get any “Valid” outputs when a valid card number is entered

#include <stdio.h> #include <cs50.h> #include <math.h> #include <stdlib.h> int main (void) { int count = 0; //Declare counter //Get input from user long number = get_long (&...
0
votes
1answer
35 views

trying to check second to last digit— cs50 pset 1 #credit#

I am trying to understand the second to last digit thing, i think i have been coding wrong the whole time. take this example 45002136581 in the walk through the guy says we take 5 0 2 1 5 1. while i ...
0
votes
1answer
23 views

PSET 1 Credit AMEX

I've calculated the Luhn's algorithm for all the credit cards and it works fine. The only issue I have is that the American Express cards which are tested don't fulfill the Luhn's algorithm! This is ...
0
votes
1answer
55 views

cs50 pset1 credit expected expression error

So, I have gotten rid of all the errors and got the code to the point to prompt the user for the credit card number and output an answer the only problem is the program falls thru to invalid every ...
0
votes
1answer
136 views

How To Use a For Loop To Store Values Into Multiple Variables?

I'm working on the Credit problem set. Along the way, I've encountered a scenario where I want to use a for loop to store multiple values. If I type printf("%d", cc_number[p]); in that for loop, it ...
0
votes
1answer
28 views

Help in PSET1: Credit. Check50 not showing up

I finished (what I think) is a correct version of credit and when I submit, I only see marks for style and no check50 on the submit50 page. Also, when I do check50 in the terminal window, I get a "...
0
votes
1answer
82 views

Credit.c works, but not completely?

So I finished credit.c today and was trying out different numbers from the paypal website the course provided and got some unexpected results and don't know what to do with it. When I type in valid ...
1
vote
2answers
124 views

error at while loop cs50 Pset1 credit

I am getting an error at while loop it says error: '&&' within '||' [-Werror,-Wlogical-op-parentheses] while((credit % 10 >= 0) && (i < 15) || (i < 16)) here is my ...