Created
November 12, 2019 12:51
-
-
Save junhoyeo/15b601031b14c54165465a4e455a64b4 to your computer and use it in GitHub Desktop.
오영준구원해드림 적용알아서
This file contains hidden or 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
| #pragma once | |
| #ifndef _SAVE_SCORE_ | |
| #define _SAVE_SCORE_ | |
| #include <stdio.h> | |
| // score.txt에서 현재 점수를 가져온다. | |
| int load_score() { | |
| int score; | |
| FILE * fp = fopen("./score.txt", "r"); | |
| fscanf(fp, "%d", &score); | |
| fclose(fp); | |
| return score; | |
| } | |
| // 인수로 받은 int형의 score를 score.txt에 저장한다. | |
| void save_score(int score) { | |
| FILE *fp = fopen("./score.txt", "w"); | |
| fprintf(fp, "%d\n", score); | |
| fclose(fp); | |
| } | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment