首页 > 解决方案 > 我们可以在 C 中的不同连续行中采用不同的数据类型输入吗

问题描述

int main()

    int c,s;
    char h;
    printf("Enter the carbon\n");
    scanf("%d",&c);
    printf("Enter the hard\n");
    scanf("%c",&h);
    printf("Enter strength\n");
    scanf("%d",&s);
    
    printf("%d%d",c,s);
    printf("%c",h);
}

输出:

Enter the carbon

4

Enter the hard

Enter strength

我的程序没有读取字符数据类型。谁能告诉我原因?编译器没有显示任何错误。

标签: cinputtypes

解决方案


推荐阅读