大神,这两个为啥是异常呢??
一开始a不初始化,用scanf_s也是一样的异常。然后整个运行界面都关不掉了,只能重启软件
程序代码:
#include "stdafx.h" int main() { int i, j,average; int s = 0; int v[3], a[5][3] = { {2,5,6},{48,59,4},{18,98,4},{9,65,32},{5,8,4} }; printf("inpute score\n\n"); for ( i = 0; i < 5; i++) { for (j = 0; j < 3; i++) { //scanf_s("&s", &a[i][j]); s = s + a[i][j]; v[j] = s/5; s = 0; } average = (v[0] + v[1] + v[2]) / 3; } printf("average=%d", average); getchar(); getchar(); return 0; }