用C语言将txt文件读入后,如何存入不同的数组,并输出在屏幕上答:&dServicetime); fprintf(stdout,"%d,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f\n",num,dCoordinateX,dCoordinateY,nDemand,nTimewindowE,nTimewindowL,dServicetime); } fclose(fp);system("pause"); return 0;} 你那些读取都乱用的%d,%f,%lf要分清好不。全是数字要用什么数组呢 ...
分别用C语言和C++读取txt文件到一个二维数组答:参考思路:打开文件,然后读入一行到字符串str里面,循环读取行即可;参考例子如下:include <stdio.h> include <stdlib.h> / 1.txt 1,2,3,4,5,6,7 8,9,10,11,12,13,14 15,16,17,18,19,20,21 / int main (){ FILE *fp;int **a;//定义二维数组 int i,j;int row=0,...