Skip to content

Instantly share code, notes, and snippets.

@ruyut
Created March 28, 2019 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruyut/a6527eafd16a0f4b26ca1082be7ec1df to your computer and use it in GitHub Desktop.
Save ruyut/a6527eafd16a0f4b26ca1082be7ec1df to your computer and use it in GitHub Desktop.
//905-2
#include<stdlib.h>
#include<stdio.h>
int main() {
FILE *fi;//宣告檔案指標
double ss;//宣告雙精浮點數
fi = fopen("dnumber.dat", "r");//使用讀取的方式開啟檔名為dnumber.dat的檔案
while (fscanf(fi, " %lf ", &ss) != EOF) {//如果讀不到資料就跳出
printf("%.2lf\n", ss);//列印雙精浮點數
}
fclose(fi);//關閉檔案
system("PAUSE");//等待使用者按下任意按鍵
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment