69,382
社区成员
发帖
与我相关
我的任务
分享
#include <stdlib.h>
#include <stdio.h>
int main()
{
BEG:
double x_core[4][5];
for ( int person = 0 ; person < 3 ; ++person )
{
printf( " Please Input %d Person 's Degrees!\r\n" , person + 1 );
scanf( "%d,%d,%d,%d" , &x_core[person][0] , &x_core[person][1] , &x_core[person][2] , &x_core[person][3] );
for ( int kind = 0 ; kind < 4 ; ++kind )
{
if ( x_core[person][kind] > 100 || x_core[person][kind] < 0 )
{
printf( "Input Error , Please Input One More Time !\r\n" );
goto BEG;
}
x_core[person][4] = ( x_core[person][0] + x_core[person][1] + x_core[person][2] + x_core[person][3] ) / 4;
}
}
for ( int kind = 0 ; kind < 4 ; ++kind )
{
x_core[3][kind] = ( x_core[0][kind] + x_core[1][kind] + x_core[2][kind] )/ 3;
}
x_core[3][4] = ( x_core[0][4] * 4 + x_core[1][4] * 4 + x_core[2][4] * 4 ) / ( 3 * 4 );
}
//仅供参考!~