Questions tagged [hacker1]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
475 views

PSET 1 Hacker Mario [duplicate]

The instructions are here: http://cdn.cs50.net/2016/x/psets/1/hacker1/hacker1.html#itsa_mario and here for the full understanding of the basic requirements: http://cdn.cs50.net/2016/x/psets/1/pset1/...
KhalidMukadam's user avatar
0 votes
1 answer
342 views

Credit Card Test Confusion

I am supposed to find if cc numbers are valid based on these rules: Multiply every other digit by 2, starting with the number’s second-to-last digit, and then add those products' digits together. ...
KhalidMukadam's user avatar
0 votes
1 answer
516 views

CS50 PSET 1 Hacker Bad Credit Code

The goal is to find if a credit card number is valid. Complete Instructions Here: https://cdn.cs50.net/2015/x/psets/1/hacker1/hacker1.html#bad_credit Can I please know what makes my code fail? (I ...
KhalidMukadam's user avatar
0 votes
0 answers
110 views

CS50 PSET 1 Hacker Bad Credit

With this code, I want to "Multiply every other digit by 2, starting with the number’s second-to-last digit, and then add those products' digits together"get the ". I don't get the correct results, ...
KhalidMukadam's user avatar
0 votes
1 answer
109 views

Water.c Hacker1 check50 error

This program works fine. But check50 show this errors. Anyone can help me please. Thanks! check50 report: :) water.c exists :) water.c compiles :) 1 minute equals 12 bottles :) 2 minutes equals 24 ...
user avatar
0 votes
0 answers
169 views

CS50: Bad Credit - pset1 hacker1: Program compiling but not executing

the following code for CS50's hacker edition Bad Credit is compiling but is not executing. Would really appreciate a review: #include<stdio.h> #include<cs50.h> #include<math.h> // ...
TheModernYoda's user avatar
1 vote
3 answers
177 views

hacker1 edition of mario.c, alternative solution, check50 expected output for heigth 2 and 23

I started with mario.c from hacker1 problem set. I found a tricky and fast solution (when building up really high pyramids > 1000 rows) to build up the pyramids using printf's align functionallity ...
Frank Geister's user avatar
0 votes
1 answer
170 views

Pset1 Hacker Edition, Bad Credit "INVALID" Result!

#include <stdio.h> #include <cs50.h> #include <math.h> int main(void) { long long n; int nDigits; long long k1, k2, k3, k4, k5, k6, k7,k8,k9,k10,k11,k12,k13,k14,k15,k16;...
Sena Cetinkaya's user avatar
0 votes
0 answers
259 views

Pset1, Hacker1,Credit.C, error while converting long long into an array

TL;DR Why does METHOD2 below work and not METHOD1?? I'll preface this with saying that after hours of trial and error, I got the code to work. However, I am still VERY CONFUSED as to why one method ...
crazyflier's user avatar
0 votes
1 answer
292 views

Hacker pset1 credit.c always gives invalid?

I tried to attempt the credit.c problem. My code is as follows: #include <stdio.h> #include <cs50.h> #include <math.h> #include <string.h> int main(void) { printf("Please ...
user107224's user avatar
0 votes
1 answer
164 views

What is wrong with my hacker mario.c code for pset1?

I managed to complete the hacker version of the mario.c problem in pset1 using "for" loops. However, when I re-tried the problem using "if" and "else if", I could not achieve similar results. Here is ...
user107224's user avatar
0 votes
3 answers
762 views

Infinite looping in hacker 1 - water

My do-while loop successfully rejects negative numbers and 0, however, if I input text such as "foo" when prompted for the length of a shower in minutes, the program runs into an infinite loop, ...
Tomas Vrba's user avatar
0 votes
1 answer
93 views

Hacker1 seems to run properly, but won't pass check50

I completed pset1 but I seem to have some problem running the Check50. when I put my output next to the one provided for testing, it seems the exact same... I tried to use an array with chars, is it ...
Lourenço Czernin's user avatar
0 votes
2 answers
241 views

credit.c frustration

Im considering skipping :( I dont really understand why it always prints INVALID4.... #include <stdio.h> #include <cs50.h> #include <math.h> int main (void) { //Initialize a ...
Thomas Adrianus Vreugdenhil's user avatar
0 votes
1 answer
98 views

credit.c help too debug please

Well i tried to debug it, by giving each INVALID a number, but i keep getting invalid 4, i think it is in the sum of array, but can someone look for the bug, i am just getting stressed out... #...
Thomas Adrianus Vreugdenhil's user avatar
-1 votes
1 answer
99 views

Why isnt my program working? credit.c

Well I decided to make the credit.c program, and I did, I started debugging and so until it compiled. But it always outputs INVALID and I can´t find out why, so this is my code: #include <stdio.h&...
Thomas Adrianus Vreugdenhil's user avatar
0 votes
1 answer
2k views

Credit GetLongLong Issue

I'm having issues using the GetLongLong function. For some reason the output I get doesn't match the input I put in. Here, is my code. #include <studio.h> #include <cs50.h> int main(void)...
Tori_T's user avatar
  • 1
0 votes
1 answer
185 views

Processing the separated digits using Luhn's Algorithim

My code compiles and runs. Separating out the required numbers also works. The problem in my output seems to start at the processing of Luhn's Algorithim. The section of below code processes the ...
Mo1's user avatar
  • 142
0 votes
1 answer
37 views

Infinite looping

Credit PSET 1 Hacker: The below code compiles and executes but in an infinite loop. I've tried writing the while condition a few different ways, but it seems to end up the same. I can get the ...
Mo1's user avatar
  • 142
0 votes
1 answer
163 views

hacker1 mario: output appear correct, but won't pass check50

I have fiddled around with it a bit. I thought it might be the extra spaces after the second half-pyramid, but I removed them and I still can't get it to work. I appreciate the help. Thanks!
Tom L.'s user avatar
  • 7
0 votes
2 answers
24k views

How to convert the digits of a number into elements of array?

For example in pset1 hacker edition program asks user to input the number of credit card. Imagine that a digits are: 1234567890 So can anyone tell me does it possible to convert this number into ...
spell78's user avatar
0 votes
0 answers
122 views

hacker credit expected output

I'm getting that dreaded "expected output" error when running check50. Thing is, I don't have an added newline \n in my code. The actual output sure appears to be identical to what the checker was ...
Brian Hodges's user avatar
3 votes
1 answer
177k views

Why do I get the "invalid operands to binary expression" error?

While trying to solve credit, I get the following error rem and number1 are declared as long and even if I change them to int, I still get the same error. Please provide a solution and explain what ...
Prateek Pande's user avatar
0 votes
1 answer
120 views

Should I submit both Mario & Bad Credit or only choose one?

For pset1, should I submit both tasks (Mario & Bad Credit) or just choose one?
abdelrhman moustafa's user avatar
0 votes
2 answers
682 views

errors I cant understand in credit.c can anyone explain?

I am taking the number as a string(n) and then trying to convert the string into ints to add them like this: else if(strlen(n)==15 && (n[1]==3&&(n[2]==4||n[2]==7))) { for(i=14;i&...
Mohamed Alaa El-Din Fathy's user avatar
1 vote
2 answers
420 views

hacker1 mario runs properly but fails check50

As you can see the code runs fine and gives the expected output of double pyramid for the numbers entered between 0 and 23 but check 50 says i have an error can someone enlighten me about what i have ...
Nikilesh Reddy's user avatar
0 votes
1 answer
63 views

Code Debugging: Help?

Looking for some debugging help. I moved printf statements in and out of the code to see where the problem was coming from. I know that everything prior to this is correct and that the loop executes ...
Daniel Levi's user avatar
0 votes
1 answer
71 views

Is it bad to use an ellipsis to handle a range of values in one case of a switch statement?

I was hoping to use a switch statement for the printf("CARD_NAME"); part of my code, and was wondering if it was bad style/practice to use ... like below? The examples from class all show to use case ...
user avatar
0 votes
1 answer
136 views

credit.c project in hacker1 I keep having this error?

While trying to compile the codes uploaded I keep having this error which I couldn't understand!
Mohamed Alaa El-Din Fathy's user avatar
0 votes
1 answer
186 views

Why is the last digit of my credit card number wrong in hacker1?

I was working on the hacker version of pset1 and I was using a for loop to grab the values of every single individual number (in CC#) and transfer it to an array. The for loop works fine, except that ...
Jon's user avatar
  • 21
3 votes
1 answer
375 views

Why Does credit Fail Passing check50 Tests?

When I input the credit card numbers that check50 inputs in its tests to my program myself, It correctly identifies the numbers as expected. However, when I run check50, it's not identifying correctly....
Caleb Bickford's user avatar
2 votes
2 answers
3k views

problems with long long variable type

I´ve been looking over internet and through the man cs50.h to find out why a simple program like this generates values error from 8 onwards, but i couldn't find why reads a value and stores another. ...
dizcola's user avatar
  • 111
2 votes
3 answers
2k views

hacker1 - credit - Problems on some card numbers

The logic from hacker1: Multiply every other digit by 2, starting with the number's second-to-last digit, and then add those products' digits together. Add the sum to the sum of the digits ...
Mateus Pires's user avatar