Questions tagged [getint]
The getint tag has no usage guidance.
26 questions
0
votes
1
answer
186
views
Error when I try to use get_int
I have included cs50.h library, and I've ran the program after substituting a number in place of the get_int function and the program works completely fine, so something is wrong with using the ...
0
votes
1
answer
42
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 ...
0
votes
1
answer
122
views
What is the problem with my get_int for the lab 1 question population in C?
when i make the code and i type ./population, the question asked is start size:, and when i type in an x value that is 9 or more, the question keeps reprompting and I keep looking through and I don't ...
1
vote
1
answer
1k
views
Difference between scanf and get_int
Suppose I want a user to enter an integer between 1 and 8.
To start with, here is the program that uses scanf to accept integer from user.
#include <stdio.h>
#include <cs50.h>
int main (...
2
votes
2
answers
7k
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
1
answer
217
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
1
answer
205
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
3
answers
4k
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
1
answer
48
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
3
answers
81
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
1
answer
46
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
1
answer
403
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
1
answer
621
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
2
answers
133
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
1
answer
156
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
1
answer
599
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
1
answer
850
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
2
answers
214
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
1
answer
68
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
1
answer
89
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
1
answer
151
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
2
answers
238
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
1
answer
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
1
answer
5k
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
1
answer
554
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
1
answer
559
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 ...