c - 简单的计数程序问题

标签 c

出于某种原因,我的 printf 和 scanf 显然未声明。我认为这与我不太了解的功能有关。

#include<stdlib.h>
#include<stdlib.h>
#include<ctype.h>

void testCount ();

int eleven = 11;
int input = 0;
int output = 0;
int count = 0;

int main (){
    printf("What number would you like to count to?");
    scanf("%d", &count);
    testCount();
    system("pause");
    return 0;
}

void testCount (int x){
    int y;
    for(y=1;y<count;y++){
        if (x < 10){ 
           x + 1;
        }
    }    
    output = input/eleven;
}

最佳答案

您需要#include <stdio.h>解决问题 printf()scanf() 。您有#include <stdlib.h>两次。

此外,您应该更改:

void testCount ();

至:

void testCount (int x);

按照@Keine Lust 的建议。请不要忘记将值传递给新创建的 testCount()功能!

关于c - 简单的计数程序问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40102769/

相关文章:

c - C offsetof 宏如何工作?

c - 为什么使用 DDD 时没有出现设置断点挂起的选项?

c++ - pthread 我可以获得原始参数吗?

c - 文档互斥定义

java - GCC 和 JVM 自动并行批处理

在文件管理中检测到 c 堆栈粉碎

cygwin make - 对 INT_MAX 和 argp_usage 的 undefined reference

c - 在C中输入和反转多个字符串?

c - 修改 char *array[x][y]

C 中的卷积边缘检测