Created
March 28, 2019 05:24
-
-
Save ruyut/94233769717baecbdf381a36e6f24fc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//905-1 | |
#include<stdlib.h> | |
#include<stdio.h> | |
int main() { | |
FILE *fi;//宣告檔案指標 | |
double ss;//宣告雙精浮點數 | |
fi = fopen("dnumber.dat", "w");//使用寫入的方式開啟檔名為dnumber.dat的檔案 | |
do { | |
printf("請輸入浮點數:"); | |
scanf("%lf", &ss);//輸入雙精浮點數 | |
if (ss != -99.99)//如果變數不是-99.99的話 | |
fprintf(fi, "%lf ", ss);//把數字寫入到檔案當中 | |
} while (ss != -99.99);//如果變數不是-99.99的話就繼續重複執行 | |
fclose(fi);//關閉檔案 | |
system("PAUSE");//等待使用者按下任意按鍵 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment