Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C编程循环_C - Fatal编程技术网

C编程循环

C编程循环,c,C,我从事的这个项目是:计算你同学的平均身高。 以英尺和英寸为单位输入高度。 验证脚是否在3-8范围内,0到范围内的英寸另一个字符的扫描格式应仅为%c。否则,我认为它是正确的。为什么不使用公制测量?@EdHeal读取高度的英尺部分的代码在哪里?%\n%c->%cha您尝试运行代码了吗?你到底遇到了什么问题?你试过运行你的代码吗?你到底有什么问题?应该是对问题的评论,而不是回答。 #include <stdio.h> int main( void ) { char another

我从事的这个项目是:计算你同学的平均身高。 以英尺和英寸为单位输入高度。
验证脚是否在3-8范围内,0到范围内的英寸另一个字符的扫描格式应仅为%c。否则,我认为它是正确的。

为什么不使用公制测量?@EdHeal读取高度的英尺部分的代码在哪里?%\n%c->%cha您尝试运行代码了吗?你到底遇到了什么问题?你试过运行你的代码吗?你到底有什么问题?应该是对问题的评论,而不是回答。
#include <stdio.h>

int main( void )
{
    char another;
    int feet;
    double inches, total = 0, average;

    printf( "Do you have a student? (y/n)" );
    scanf( "%\n%c", &another );

    while ( another == 'y' )
    {
        do
        {
            printf( "Enter inches: " );
            scanf( "%lf", &inches );
        }
        while ( inches < 0 || inches >= 12 );

        printf( "Do you have a student? (y/n)" );
        scanf( "%\n%c", &another );

    }

    return 0;
}