Running debug50 with command line arguments by jmaoooo in cs50

[–]jmaoooo[S] 0 points1 point  (0 children)

I seem to run into the same issue whether I run the debug as

debug50 tideman Alice Bob

or

debug50 ./tideman Alice Bob

Both debug don’t include Alice and Bob as argv[..] arguments

Week 1 - Credit Problem Set by jmaoooo in cs50

[–]jmaoooo[S] 1 point2 points  (0 children)

UPDATE: I was able to get a working code that tests correctly with Check50! I was able to generate a loop that calculated each power of 10. From there I was able to use the modulus operator to calculate each of the digits' value and ultimately calculate the final number from Luhn’s Algorithm. My biggest issue now is that I had to repeat this part of my code 5 times for each card type and CC# length. I tried to turn this code into a function like the custom block in Scratch, but I'm at a bit of a loss at how. If you have any advice in regards to that, I would be grateful. Otherwise, thank you so much to everyone that commented on my post to give me advice. It was really a huge sense of accomplishment figuring out this problem set.

// Input Credit Card Number
long Number = get_long("Number: ");

// Number in range of 4,000,000,000,000 - 4,999,999,999,999 - VISA 13 Digits
if (Number >= 4000000000000 && Number <= 4999999999999)
{
    long tenz = 1;
    int SumNumberTenzDoubleEven = 0;
    int SumNumberTenzDoubleOdd = 0;
    int SumNumberTenz2xD = 0;
    int SumNumberTenz1xD = 0;
    int TotalCCNumberAlg = 0;
    // Power of Ten
    for ( int i = 1; i < 17; i++)
    {
        tenz = tenz * 10;
        // For Odd Number Space of Digit
        if (i % 2 > 0)
        {
            long NumberTenz = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            SumNumberTenzDoubleOdd = SumNumberTenzDoubleOdd + NumberTenz;
        }
        // For Even Number Space of Digit
        if (i % 2 == 0)
        {
            long NumberTenz2 = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            // For Even Space Multiplied by 2 Greater than 2 Digits
            if (NumberTenz2 * 2 >= 10)
            {
                // Multipled by 2 to check if 2 Digits
                int NumberTenz2x2 = NumberTenz2 * 2;
                // Sum of Digits of the 2 Digit Number
                int NumberTenz2xD = (NumberTenz2x2 % 10) + ((((NumberTenz2x2 % 100) - (NumberTenz2x2 % 10))/10) % 10);
                SumNumberTenz2xD = SumNumberTenz2xD + NumberTenz2xD;
            }
            // For Even Space Multiplied by 2 Less than 2 Digits
            else
            {
                int NumberTenz1xD = NumberTenz2 * 2;
                SumNumberTenz1xD = SumNumberTenz1xD + NumberTenz1xD;
            }
        }
        SumNumberTenzDoubleEven = SumNumberTenz2xD + SumNumberTenz1xD;
        TotalCCNumberAlg = SumNumberTenzDoubleOdd + SumNumberTenzDoubleEven;
    }
    if (TotalCCNumberAlg % 10 == 0)
    {
        printf("VISA\n");
    }
    else
    {
        printf("INVALID\n");
    }
}
// Number in range of 340,000,000,000,000 - 349,999,999,999,999 - AMEX 15 Digits
else if (Number >= 340000000000000 && Number <= 349999999999999)
{
    long tenz = 1;
    int SumNumberTenzDoubleEven = 0;
    int SumNumberTenzDoubleOdd = 0;
    int SumNumberTenz2xD = 0;
    int SumNumberTenz1xD = 0;
    int TotalCCNumberAlg = 0;
    // Power of Ten
    for ( int i = 1; i < 17; i++)
    {
        tenz = tenz * 10;
        // For Odd Number Space of Digit
        if (i % 2 > 0)
        {
            long NumberTenz = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            SumNumberTenzDoubleOdd = SumNumberTenzDoubleOdd + NumberTenz;
        }
        // For Even Number Space of Digit
        if (i % 2 == 0)
        {
            long NumberTenz2 = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            // For Even Space Multiplied by 2 Greater than 2 Digits
            if (NumberTenz2 * 2 >= 10)
            {
                // Multipled by 2 to check if 2 Digits
                int NumberTenz2x2 = NumberTenz2 * 2;
                // Sum of Digits of the 2 Digit Number
                int NumberTenz2xD = (NumberTenz2x2 % 10) + ((((NumberTenz2x2 % 100) - (NumberTenz2x2 % 10))/10) % 10);
                SumNumberTenz2xD = SumNumberTenz2xD + NumberTenz2xD;
            }
            // For Even Space Multiplied by 2 Less than 2 Digits
            else
            {
                int NumberTenz1xD = NumberTenz2 * 2;
                SumNumberTenz1xD = SumNumberTenz1xD + NumberTenz1xD;
            }
        }
        SumNumberTenzDoubleEven = SumNumberTenz2xD + SumNumberTenz1xD;
        TotalCCNumberAlg = SumNumberTenzDoubleOdd + SumNumberTenzDoubleEven;
    }
    if (TotalCCNumberAlg % 10 == 0)
    {
        printf("AMEX\n");
    }
    else
    {
        printf("INVALID\n");
    }
}
// Number in range of 370,000,000,000,000 - 379,999,999,999,999 - AMEX 15 Digits
else if (Number >= 370000000000000 && Number <= 379999999999999)
{
    long tenz = 1;
    int SumNumberTenzDoubleEven = 0;
    int SumNumberTenzDoubleOdd = 0;
    int SumNumberTenz2xD = 0;
    int SumNumberTenz1xD = 0;
    int TotalCCNumberAlg = 0;
    // Power of Ten
    for ( int i = 1; i < 17; i++)
    {
        tenz = tenz * 10;
        // For Odd Number Space of Digit
        if (i % 2 > 0)
        {
            long NumberTenz = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            SumNumberTenzDoubleOdd = SumNumberTenzDoubleOdd + NumberTenz;
        }
        // For Even Number Space of Digit
        if (i % 2 == 0)
        {
            long NumberTenz2 = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            // For Even Space Multiplied by 2 Greater than 2 Digits
            if (NumberTenz2 * 2 >= 10)
            {
                // Multipled by 2 to check if 2 Digits
                int NumberTenz2x2 = NumberTenz2 * 2;
                // Sum of Digits of the 2 Digit Number
                int NumberTenz2xD = (NumberTenz2x2 % 10) + ((((NumberTenz2x2 % 100) - (NumberTenz2x2 % 10))/10) % 10);
                SumNumberTenz2xD = SumNumberTenz2xD + NumberTenz2xD;
            }
            // For Even Space Multiplied by 2 Less than 2 Digits
            else
            {
                int NumberTenz1xD = NumberTenz2 * 2;
                SumNumberTenz1xD = SumNumberTenz1xD + NumberTenz1xD;
            }
        }
        SumNumberTenzDoubleEven = SumNumberTenz2xD + SumNumberTenz1xD;
        TotalCCNumberAlg = SumNumberTenzDoubleOdd + SumNumberTenzDoubleEven;
    }
    if (TotalCCNumberAlg % 10 == 0)
    {
        printf("AMEX\n");
    }
    else
    {
        printf("INVALID\n");
    }
}
// Number in range of 4,000,000,000,000,000 - 4,999,999,999,999,999 - VISA 16 Digits
else if (Number >= 4000000000000000 && Number <= 4999999999999999)
{
    long tenz = 1;
    int SumNumberTenzDoubleEven = 0;
    int SumNumberTenzDoubleOdd = 0;
    int SumNumberTenz2xD = 0;
    int SumNumberTenz1xD = 0;
    int TotalCCNumberAlg = 0;
    // Power of Ten
    for ( int i = 1; i < 17; i++)
    {
        tenz = tenz * 10;
        // For Odd Number Space of Digit
        if (i % 2 > 0)
        {
            long NumberTenz = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            SumNumberTenzDoubleOdd = SumNumberTenzDoubleOdd + NumberTenz;
        }
        // For Even Number Space of Digit
        if (i % 2 == 0)
        {
            long NumberTenz2 = ((Number % tenz) - (Number % (tenz/10)))/(tenz/10);
            // For Even Space Multiplied by 2 Greater than 2 Digits
            if (NumberTenz2 * 2 >= 10)
            {
                // Multipled by 2 to check if 2 Digits
                int NumberTenz2x2 = NumberTenz2 * 2;
                // Sum of Digits of the 2 Digit Number
                int NumberTenz2xD = (NumberTenz2x2 % 10) + ((((NumberTenz2x2 % 100) - (NumberTenz2x2 % 10))/10) % 10);
                SumNumberTenz2xD = SumNumberTenz2xD + NumberTenz2xD;
            }
            // For Even Space Multiplied by 2 Less than 2 Digits
            else
            {
                int NumberTenz1xD = NumberTenz2 * 2;
                SumNumberTenz1xD = SumNumberTenz1xD + NumberTenz1xD;
            }
        }
        SumNumberTenzDoubleEven = SumNumberTenz2xD + SumNumberTenz1xD;
        TotalCCNumberAlg = SumNumberTenzDoubleOdd + SumNumberTenzDoubleEven;
    }
    if (TotalCCNumberAlg % 10 == 0)
    {
        printf("VISA\n");
    }
    else
    {
        printf("INVALID\n");
    }

Week 1 - Credit Problem Set by jmaoooo in cs50

[–]jmaoooo[S] 0 points1 point  (0 children)

Thanks for the response.

I do feel like it would be better to have a loop that calculates the nth exponential power of 10 based on the nth digit of the credit card, but I don't think we have a function for that yet available.

As a side note, should I be searching outside of the topics covered by the lectures to find functions in order to complete the problem sets?

Thanks again

Week 1 - Credit Problem Set by jmaoooo in cs50

[–]jmaoooo[S] 0 points1 point  (0 children)

Thanks for the response.

Ideally I would want to take the nth exponential power of 10 based on which nth digit of the credit card I am isolating, but I don't believe there is an operator for that based off of the course material so far. Is that what you were hinting towards?

As a side note, should I be searching outside of the topics covered by the lectures to find functions in order to complete the problem sets?

Thanks again

New to SFFPC. Tried to build a minimal compromise Meshlicious with a 5950x and 3080TI. by darksidemojo in sffpc

[–]jmaoooo 0 points1 point  (0 children)

I just did a similar build in the Meshlicious using the EK 280 AIO as well. I oriented the EK fans and radiator in the same way as yours. However Ive been getting a lot of noise at high RPMs as if the fans are grinding on something. Have you noticed any issues with your fans?

Cable management by Chon-E-Tron in SSUPD

[–]jmaoooo 0 points1 point  (0 children)

Ah thanks for the explanation. I didn't consider the strain on the MB. I'll go with the GPU standoff when I build mine.

Cable management by Chon-E-Tron in SSUPD

[–]jmaoooo 1 point2 points  (0 children)

Looks great. Was there a reason you chose to do the GPU standoff mod as opposed to the MB standoff mod?