标签:col open return ret htm 读取 tsp fopen com
https://www.cnblogs.com/Vincent-Bryan/p/6925639.html
1、从文件夹读入数据,并赋值给局部变量,再写入文件夹;
1) fscanf_s & fprintf
FILE *stream1, *stream2; fopen_s(&stream1, "input.txt", "r"); fopen_s(&stream2, "output.txt", "w"); int n; fscanf_s(stream1, "%d", &n); //从stream1中读取一个int fprintf(stream2, "%d", n); //将int输出到stream2 fclose(stream1); fclose(stream2); return 0;
2) scanf_s
FILE *stream; freopen_s(&stream, "TSP.txt", "r", stdin); int n; scanf_s("%d", &n); for (int i = 0; i < n; i++) scanf_s("%lf %lf", &p[i].x, &p[i].y);
标签:col open return ret htm 读取 tsp fopen com
原文地址:https://www.cnblogs.com/wllwqdeai/p/10674220.html