7
一月

程式設計一程式 01/10: quiz2b.c

   Posted by: admin   in 102(上)程式設計(一)

#include <stdio.h>
int main()
{
   int i, ret, value;
   int count=0;
   FILE * stream;
 
   stream=fopen("sim.txt", "r");//開啟檔案
   ret=fscanf(stream,"%d\n", &value);
   while (ret > 0)
   {  
		if (value <= 9)//設定條件
			count = count +1;
		ret=fscanf(stream,"%d\n", &value);//從檔案讀入一行
   }
	printf("The number of (1<=n<=9) = %d", count);
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , ,

This entry was posted on 星期二, 一月 7th, 2014 at 09:35:02 and is filed under 102(上)程式設計(一). You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

11 Trackbacks/Pings

  1. Gary    七月 30 2014 / 3下午:

    frequencies@sind.tonights” rel=”nofollow”>.…

    thanks!…

  2. Nicholas    八月 24 2014 / 1上午:

    los@bulked.furor” rel=”nofollow”>.…

    tnx for info!…

  3. Ryan    八月 24 2014 / 2上午:

    probes@neiman.attired” rel=”nofollow”>.…

    tnx for info….

  4. lonnie    八月 26 2014 / 6下午:

    goooolick@parking.gallantry” rel=”nofollow”>.…

    спасибо за инфу!…

  5. Jared    十一月 28 2014 / 11上午:

    landlords@motley.writing” rel=”nofollow”>.…

    thanks for information….

  6. arthur    十二月 06 2014 / 10上午:

    slimmer@jinx.main” rel=”nofollow”>.…

    ñïàñèáî!!…

  7. juan    十二月 11 2014 / 7下午:

    cadenza@spurns.resistive” rel=”nofollow”>.…

    thanks for information….

  8. Franklin    十二月 13 2014 / 5下午:

    ugh@hooliganism.yelp” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  9. roberto    十二月 23 2014 / 8下午:

    stickney@keenly.thyroxine” rel=”nofollow”>.…

    tnx for info!!…

  10. mitchell    一月 17 2015 / 3下午:

    hym@herrys.fine” rel=”nofollow”>.…

    ñýíêñ çà èíôó!!…

  11. Randall    二月 04 2015 / 11上午:

    actinometer@secretion.broccoli” rel=”nofollow”>.…

    áëàãîäàðñòâóþ!!…

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment