[問題] C語言初學者想邏輯卡關
問題(Question):
自in.txt輸入N筆資料,自out.txt輸出大於10的資料,且由大自小排序
1.in.txt的資料是 12 9 11 13 10 ,out.txt的資料是12 11 13
(讀檔後 限定輸出範圍再存檔)
2.in.txt的資料是12 9 11 13 10,out.txt中的資料為:3
(N筆資料中計算次數)
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
#include<stdio.h>
FILE *fp;
int main ( ){
int i
fp=fopen("in.txt","r+");
for( i=13; i>=10 ; i--){
fscanf(fp "%d" , &n )
fclose(fp);
}
程式碼(Code):(以請善用置底文網頁, 記得排版,禁止使用圖檔)
補充說明(Supplement):
小觀念看網路教學還可粽合就.....
總覺得有哪裡嚴重錯誤邏輯但是想不通
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.144.96
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1524464410.A.784.html
推
04/23 14:30,
6年前
, 1F
04/23 14:30, 1F
→
04/23 14:50,
6年前
, 2F
04/23 14:50, 2F
→
04/23 14:56,
6年前
, 3F
04/23 14:56, 3F
→
04/23 14:56,
6年前
, 4F
04/23 14:56, 4F
→
04/23 19:26,
6年前
, 5F
04/23 19:26, 5F
→
04/23 19:41,
6年前
, 6F
04/23 19:41, 6F
→
04/23 21:13,
6年前
, 7F
04/23 21:13, 7F
→
04/23 22:16,
6年前
, 8F
04/23 22:16, 8F
→
04/23 22:19,
6年前
, 9F
04/23 22:19, 9F
→
04/23 22:22,
6年前
, 10F
04/23 22:22, 10F
推
04/23 22:29,
6年前
, 11F
04/23 22:29, 11F
→
04/23 22:30,
6年前
, 12F
04/23 22:30, 12F
推
04/24 09:00,
6年前
, 13F
04/24 09:00, 13F
→
04/24 13:00,
6年前
, 14F
04/24 13:00, 14F
推
04/25 03:03,
6年前
, 15F
04/25 03:03, 15F
→
04/25 03:03,
6年前
, 16F
04/25 03:03, 16F