diff --git a/step3.cpp b/step3.cpp new file mode 100644 index 0000000..43df14b --- /dev/null +++ b/step3.cpp @@ -0,0 +1,36 @@ +#include +int main(){ + printf(" 1.Input\n"); + printf(" 2.Output\n"); + printf(" 3.Order\n"); + printf(" 4.Quit\n"); + char a; + scanf("%c",&a); + if(a=='i'){ + printf("Please input info of the three students:\n"); + }else if(a=='o'){ + printf("You are trying to Output info\n"); + }else if(a=='m'){ + printf("You are trying to Make things ordered\n"); + }else if(a=='q'){ + printf("You are about to Quit\n"); + }else{ + printf("Wrong input"); + } + float num[3][4]; + for(int i=0;i<3;i++){ + for(int j=0;j<4;j++){ + scanf("%f",&num[i][j]); + } + } + for(int i=0;i<3;i++){ + float sum; + for(int j=1;j<4;j++){ + sum+=num[i][j]; + if(j==3){ + printf("%.0f,%.1f,%.1f\n",num[i][0],sum,sum/3); + sum=0; + } + } + } +}