Questions tagged [getint]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
10 views

GetInt function not recognised

i am unable to compile my code due to GetInt function not recognized, i have tried all the solutions available, but none seems working for me... here is my code: [EDIT: unrelated code removed] // ask ...
0
votes
0answers
28 views

it works in cs50 sandbox but when i use terminal to compile it doesnt

i followed the code about mario thing i used make mario / gcc -g mario.c -o mario -lcs50 -lm when i use make mario1.c:9:7: warning: implicit declaration of function 'get_int' is invalid in ...
0
votes
1answer
47 views

Mario problem in IDE

I was trying to run the below program on CS50 IDE, however it shows an error, is it something wrong with the CS50 IDE ? #include <cs50.h> #include <stdio.h> int main(void) { int n; ...
0
votes
1answer
15 views

How to make my code print?

So my code printed fine when I used printf and scanf together but when I changed it to the get_int command it no longer prints anything. How do I use get_int and still print my code? The purpose of ...
0
votes
3answers
32 views

Mario Problem set 1 undefined reference

This is the error I'm getting and I'm not sure why it isn't working because this is how it was done in the example in the lecture. This is done using and for reference. I've looked similar questions ...
0
votes
1answer
42 views

Why is condition being ignored?

I have the following code for C int get_pyramid_steps(string prompt); //Ask height int main(void) { int i = get_int("pick a number: "); printf("you said %i\n", i); } //if i < 1 or i &...
0
votes
3answers
2k views

Week 1: get_int & get_string errors

Fro the files int.c and string.c, I copied the code from the lecture exactly, and was receiving errors, then modified the code according to suggestions online by adding #include <cs50.h>and I'm ...
0
votes
1answer
368 views

I have a GetInt Function issue (Pset1)

I keep on receiving this error message: 'GetInt' has been explicitly marked deprecated here int GetInt(void) __attribute__((deprecated));' Please find my code below: n = GetInt(); Thanks in ...
0
votes
2answers
120 views

pset1 - CS50 directory not found for ./integer. Keep getting bash error - help?

~/workspace/ $ cd pset1 ~/workspace/pset1/ $ ./integer bash: ./integer: No such file or directory
0
votes
1answer
142 views

Pset1 Water Issue, reprompting with “Retry: ” for Non-integers, and “Minutes: ” for negative integers

My water program seems to work decently, it passes all of the check50 tests just fine. My issue is that when the user enters a negative integer, the program re-prompts with "Minutes; ", but when the ...
2
votes
1answer
532 views

get_int() cause error after update cs50IDE

After I update cs50 IDE, the get_int() comes to error and I can't even compile the simplest program. #include <stdio.h> #include <cs50.h> int main() { int s=get_int(); printf("%i",...
0
votes
1answer
448 views

Functions outside Cs50.h

I am just wondering, so far in the psets, we have been working closely with cs50.h library. In real life though, there won't be much use for the cs50.h library, so my question is: What is the ...
0
votes
2answers
142 views

Trying to reimplement GetInt()

I want to reimplement the GetInt() function from the CS50 library. I've mostly succeeded with the following code, but if I enter a single character, or CTRL+, I'm left with an extra newline so that I ...
0
votes
1answer
38 views

Printing text after GetInt()

I was wondering if there was a way to do something like the following Enter the coefficients in order __ * x^3 Where the __ is where the user will be prompted for input. However, I want the *x^3 ...
2
votes
2answers
6k views

get_int invalid?

I'm getting an error in this line: int x = get_int(); clang says: water.c:7:13: error: implicit declaration of function 'GetInt' is invalid in C99 [-Werror,-Wimplicit-function-declaration] int ...
0
votes
1answer
597 views

Can't get the do-while loop to work in pset1

I have been trying to follow the walk through for pset1 and I cannot get my code to work for the first part of water. It will not let me execute the do-while loop. I have written the code just like ...
0
votes
1answer
52 views

Get Int wont accept my decimal Input

So I'm in pset1 and I'm trying to finish the problem set "change". I have the whole program finished... the problem is that getint() wont let me grab decimal numbers. Im not sure if I have to add a ...
0
votes
1answer
72 views

GetInt + sscanf — why doesn't it accept only characters?

Going through the Week 5 walkthroughs and there's an interesting line of code in getint to make sure the user has only typed an int: if (sscanf(line, " %i %c", &n, &c) == 1) { // continue} ...
0
votes
1answer
105 views

GetInt() Can not read more than 10 Digits and proplems with zero!

Hello Guys I'm on the hacker edition on pset1 I just wants to get the number of digits that the users type but it doesn't want to read more than 10 digits ! and when typing zero as a first digit ...
0
votes
2answers
228 views

Mario GetInt: When integer outside range entered, have to hit enter twice to get RETRY

Here is an excerpt from my code for Mario. int main(void) { printf("Please enter the pyramid height.\n(A positive integer <= 23.)\n"); int h=0; do { h = GetInt(); } ...
-2
votes
1answer
3k views

implicit declaration of function getint() is invalid in c99

#include <cs50.h> #include <stdio.h> int main (void) { printf("get the value of x \n"); int x = getint(); printf("y \n"); int y = getint(); printf("addition of %d and %...
2
votes
1answer
4k views

undefined reference to `GetInt'

I wish anyone could give a clue on this: I've started the cs50 course, amazing!. But, I am not using the cs50 appliance, I use fedora 20 OS, got installed the cs50 library according guidelines but I ...
0
votes
1answer
500 views

int GetInt(void) and command line arguments

Why don't the Get functions, GetString, GetInt etc, take command line arguments like the main function? It seems to me that they should since command lines are being inputed into the function.
1
vote
1answer
508 views

Awkward behaviour of GetInt()

So i am working on a linked list program and am using functions like insert, delete and search which require taking input from the user and so i tried using GetInt() from the CS50 library for the same ...