Timeline for pset1: credit - code not working
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 3, 2017 at 19:15 | history | edited | Chris | CC BY-SA 3.0 |
edited title
|
Aug 25, 2017 at 6:33 | vote | accept | Chris | ||
Aug 25, 2017 at 6:21 | comment | added | Chris | Now I see what you're saying... yeah that extra step took me a long time! I included <cs50.h> though. | |
Aug 25, 2017 at 5:18 | answer | added | robert_x44 | timeline score: 1 | |
Aug 25, 2017 at 5:05 | comment | added | robert_x44 | the bool data type is in <cs50.h>, did you include it? | |
Aug 25, 2017 at 5:02 | comment | added | robert_x44 | You can do it either way, it's just easier operating on an integer, to use / and % you'll have to turn your string into an integer, so it saves a step. | |
Aug 25, 2017 at 4:58 | comment | added | Chris | It seems getting the number as a string can work too? I'd like to try using get_long_long but I'd like to make this work first since I already started. Thanks for letting me know the / and % part was a good idea! I just updated the code I have now but it's not giving me the correct output. | |
Aug 25, 2017 at 4:55 | history | edited | Chris | CC BY-SA 3.0 |
update the code
|
Aug 25, 2017 at 0:07 | comment | added | robert_x44 |
Why are you getting the number as a string? The specification says you can use get_long_long to get the number as a long long . Besides that, getting the digits with / and % is a good idea. Try writing out on a piece of paper a long number, and use these two operators to get the digits (starting from the ones place). You can make a loop from that.
|
|
Aug 24, 2017 at 23:54 | history | asked | Chris | CC BY-SA 3.0 |