[»çÀ̹ö ¼ö¾÷33]
<µµ¼öºÐÆ÷Ç¥>


<¹®Á¦> 'input.txt'ÆÄÀÏ¿¡¼­ ÁÖ¾îÁø n°³ÀÇ data¸¦ ÀÔ·Â¹Þ¾Æ µµ¼öºÐÆ÷Ç¥¸¦ ±¸ÇÑ ÈÄ 'output.txt'¿¡ Ãâ·ÂÇÏ´Â ÇÁ·Î±×·¥À» ÀÛ¼ºÇϽÿÀ!
(Á¶°Ç1) dataÀÇ °¹¼ö´Â 20°³ÀÌÇÏ·Î ÇÕ´Ï´Ù.
(Á¶°Ç2) °è±ÞÀÇ Å©±â´Â 10 À¸·Î ÇÕ´Ï´Ù. ¿¹) 0~10, 11~20, 21~30 ....
(Á¶°Ç3) º¯·®ÀÇ ¹üÀ§´Â Á¤¼ö 0 ºÎÅÍ 100»çÀÌ·Î ÇÕ´Ï´Ù.


n = <-ÀÔ·ÂÇÒ dataÀÇ °¹¼ö¸¦ ÀÔ·ÂÇϽÿÀ(data´Â 20°³ÀÌÇÏ)
input.txt



output.txt











(º¯¼ö¼±¾ð)
(1´Ü°è)
'input()'ÇÔ¼ö·Î ±¸ºÐ
(2´Ü°è)
'process()'ÇÔ¼ö·Î ±¸ºÐ
(3´Ü°è)
'output()'ÇÔ¼ö·Î ±¸ºÐ
main()ÇÔ¼ö
#include<stdio.h>

int d[100]= {0,}, f[11] = {0,};
int n;

int input()
{
   FILE *ifp;
   int i;

   ifp=fopen("input.txt","r");
   fscanf(ifp,"%d", &n);
   for(i=0; i<n; i++){
	fscanf(ifp, "%d", &d[i]);
   }

   fclose(ifp);

   return -1;
}

int process()
{
   int i, p;

   for(i=0; i<n; i++){
	p = d[i] -1;
	p = (p - p%10)/10;
	f[p] = f[p] +1;
   }

   return -1;
}

int output()
{
   FILE *ofp;
   int i;

   ofp=fopen("output.txt","w");
   fprintf(ofp,"  0 ~  10 : %3d\n",f[0]);
   for(i=1; i<10; i++){
       fprintf(ofp,"%3d~%3d:%3d\n",i*10+1,(i+1)*10,f[i]);
   }
   fclose(ofp);

   return -1;
}

int main()
{
   input();
   process();
   output();

   return -1;
}
d[], f[], n´Â Àü¿ªº¯¼ö·Î ¼±¾ðÇØ¾ß ÇÕ´Ï´Ù.
ÀÔ·ÂÆÄÀÏ('input.txt')¿¡¼­ dataÀǰ¹¼ö(n)¿Í n°³ÀÇ data¸¦ Àоî¿Í d[]¿¡ ÀÔ·ÂÇÑ´Ù.
µµ¼öºÐÆ÷Ç¥¸¦ ±¸ÇÏ´Â °úÁ¤ÀÔ´Ï´Ù
2´Ü°èÀÇ µµ¼öºÐÆ÷Ç¥ ±¸ÇÏ´Â °úÁ¤À» ÅëÇØ ±¸ÇØÁø data¸¦ °è±Þº°·Î Ãâ·ÂÆÄÀÏ('output.txt')¿¡ Ãâ·ÂÇÑ´Ù.
main()ÇÔ¼ö¿¡¼­ ´Ù¸¥ÇÔ¼ö¸¦ call Çϰí ÀÖ½À´Ï´Ù

[Æò°¡ ¹®Á¦]
À§ ÇÁ·Î±×·¥À» ½ÇÇèÇÏ°í ºÐ¼®Çϼ¼¿ä!



[php ¼Ò½º]

<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=euc-kr"> <bgsound src="#" ID=music loop=1 AUTOSTART=true> <SCRIPT LANGUAGE="JavaScript"> <!-- function calc(go){ var kk =eval(go.nn.value); var pp; var yy; go.namep[0].value = "0~10"; go.namep[1].value = "11~20"; go.namep[2].value = "21~30"; go.namep[3].value = "31~40"; go.namep[4].value = "41~50"; go.namep[5].value = "51~60"; go.namep[6].value = "61~70"; go.namep[7].value = "71~80"; go.namep[8].value = "81~90"; go.namep[9].value = "91~100"; for(i=0;i<10;i++) go.nameq[i].value = 0; for(i=0;i<kk;i++){ if(eval(go.namek[i].value) == 0) go.nameq[0].value = eval(go.nameq[0].value)+1; pp = eval(go.namek[i].value) -1; pp = pp - (pp%10); pp = pp/10 ; go.nameq[pp].value = eval(go.nameq[pp].value) + 1; } for(i=0;i<10;i++){ yy = eval(go.nameq[i].value); go.namez[i].value=" "; for(j=0; j<yy; j++){ go.namez[i].value = go.namez[i].value + "#"; } } } //--> </script> </head> <body> <table width="1000" border="1" cellspacing="0" cellpadding="0" align="center"> <tr> <td height="70" width="267" bgcolor="yellow"> <center> <span style=font:15pt;color:green;><font face="µ¸¿ò"> <B>[»çÀ̹ö ¼ö¾÷33]</B> </center> </td> <td heigt="70" bgcolor="pink"> <center> <b><µµ¼öºÐÆ÷Ç¥> </b> </center> </td> </tr> </font></span> </table> <br> <table width="1000" border="1" cellspacing="0" cellpadding="0" align="center"> <tr><td> <center> <table width="600" border="0" cellspacing="0" cellpadding="0" align="center"> <tr><td> <br> <form name ="ainput" action="data33.php" method="post"> <¹®Á¦> 'input.txt'ÆÄÀÏ¿¡¼­ ÁÖ¾îÁø n°³ÀÇ data¸¦ ÀÔ·Â¹Þ¾Æ µµ¼öºÐÆ÷Ç¥¸¦ ±¸ÇÑ ÈÄ 'output.txt'¿¡ Ãâ·ÂÇÏ´Â ÇÁ·Î±×·¥À» ÀÛ¼ºÇϽÿÀ!<br> (Á¶°Ç1) dataÀÇ °¹¼ö´Â 20°³ÀÌÇÏ·Î ÇÕ´Ï´Ù.<br> (Á¶°Ç2) °è±ÞÀÇ Å©±â´Â 10 À¸·Î ÇÕ´Ï´Ù. ¿¹) 0~10, 11~20, 21~30 ....<br> (Á¶°Ç3) º¯·®ÀÇ ¹üÀ§´Â Á¤¼ö 0 ºÎÅÍ 100»çÀÌ·Î ÇÕ´Ï´Ù.<br> <hr> <br> n = <input type=text name="n" maxlength=5 size=5> <input type="submit" value="È®ÀÎ"> <-ÀÔ·ÂÇÒ dataÀÇ °¹¼ö¸¦ ÀÔ·ÂÇϽÿÀ(data´Â 20°³ÀÌÇÏ) </form> <form name="cinput"> input.txt<br> <?php $form = <<<EOF <input type=text name="nn" maxlength=5 size=5 value="$n"> EOF; echo $form; ?> <br> <?php if($n <=20){ for($i=1; $i<=$n; $i++){ ?> <input type=text name="namek" maxlength=5 size=5> <?php } } ?> <input type="button" value="È®ÀÎ" onclick="calc(this.form)"> <br> <br> output.txt <br> <?php for($i=1; $i<=10; $i++){ ?> <input type=text name="namep" maxlength=7 size=7> <input type=text name="nameq" maxlength=5 size=5> <input type=text name="namez" maxlength=25 size=25> <br> <?php } ?> </form> </td></tr> </table> </center> </td></tr> </table>