如何在C中进行提示

How to make a prompt in C

这里是新程序员,我有几行代码终于可以运行了,但是我 运行 遇到了一些设计问题。代码本身,至少对我来说,按预期运行,但我不知道如何让我的终端显示“在此处插入号码”。这是当前代码的样子。

#include "cs50.h"
#include <stdio.h>

int main(void)
{

int n;
do
{
n = GetInt();
printf("Your number is!"/n);
}
while (n<1)
{
return n;
}
}

我正在寻找一种方法来获得与 n = get_int ("Insert number: "); 相同的结果但该方法会引发错误,例如:

prompt.c:10:7: warning: implicit declaration of function 'get_int' is
      invalid in C99 [-Wimplicit-function-declaration]
{ n = get_int("Insert number here %i\n", n);

或者如果我使用 n = GetInt("Insert number: ");我收到此错误消息。

prompt.c:10:14: error: too many arguments to function call, expected 0,
      have 2
{ n = GetInt("Insert number here %i\n", n);
      ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/cs50.h:87:1: note: 'GetInt' declared here
int GetInt(void);
^
1 error generated.

有没有办法让它发挥作用,以便我的终端可以提示我“在此处插入号码:”。谢谢你,干杯!

如果要打印“Insert Number here:”,可以使用printf函数。

#include <stdio.h>
int main()
{
    int testInteger;
    printf("Insert Number here: ");
    scanf("%d", &testInteger);  
    printf("Your Number is %d",testInteger);
    return 0;
}