📄 test7_3.txt
字号:
#include <sys/types.h>
#include <stdio.h>
int main(void)
{
float value, total[10];
int count, label;
FILE *fp;
for(count=0; count<10; count++)
total[count]=0;
if(!(fp=fopen("test.dat", "r")))
{
printf("Error in open file.\n");
exit(1);
}
while(!fscanf(fp, "%d%g", &label, &value))
{
total[label]+=value;
}
for(count=0; count<10; count++)
{
printf("%d: %f\n", count, total[count]);
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -