首页 > > 详细

辅导留学生C findAvg程序、讲解留学生C findAvg、C findAvg辅导

#include
#include
#include
float findAvg( size_t cols, float (*strip)[cols], size_t rows) {
float tot = 0.0;
for (int i = 1; i 0.0001) {
for (int i=1; i < rows-1; i++) {
for (int j=1; j < cols-1; j++) {
strip[i][j] = (strip[i-1][j] + strip[i+1][j] + strip[i][j-1] + strip[i][j+1])/4.0;
}
}
lastAvg = avg;
avg = findAvg(cols, strip, rows);
count++;
}
printf("average: %f, count: %d", avg, count);
} else { // go here if the malloc failed
printf("malloc error\n");
}
}
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!