    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Student Code Critique Competition</title>
        <link>http://accu.org/index.php/journals/939</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 11, #6 - Oct 1999 + Student Code Critiques from CVu journal.</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="http://accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="http://accu.org/index.php/journals/c76/">Journals</a>

                     &gt;                         <a href="http://accu.org/index.php/journals/c77/">CVu</a>

                     &gt;                         <a href="http://accu.org/index.php/journals/c129/">116</a>
                    (22)
<br />

                                            <a href="http://accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="http://accu.org/index.php/journals/c184/">Journal Columns</a>

                     &gt;                         <a href="http://accu.org/index.php/journals/c183/">Code Critique</a>
                    (39)
<br />

                                            <a href="http://accu.org/index.php/journals/c129-183/">Any of these categories</a>

                    -                        <a href="http://accu.org/index.php/journals/c129+183/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Student Code Critique Competition</h1>
<p><strong>Author:</strong>&nbsp;Administrator</p>
<p>
<strong>Date:</strong> 05 October 1999 13:15:34 +01:00 or Tue, 05 October 1999 13:15:34 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e20" id="d0e20"></a></h2>
</div>
<p>The problem is to read in a file (first item being a count of
the number of remaining items. For example the file &quot;land.dat&quot;
looks like this:</p>
<pre class="literallayout">
10
swe dan dan nor swe swe tur swe pol dan
</pre>
<p>Having read the file you must create a list of the unique
elements (so the list form the above file would be: swe, dan, nor,
tur, pol. The order of the elements is irrelevant.</p>
<p>Now the following code is the student's solution. Critique and
refine it. Then write your own model answer. Just to exercise your
brain cells a little more, answers must be in C (it is too easy in
C++&#9786;). I have left out the <tt class=
"literal">#include</tt>s</p>
<pre class="programlisting">
#define MAXLAND 10
typedef struct { char namn[4]; }test;
int main(void){
  FILE *fil;
  test Ttest[MAXLAND],Ttemp[MAXLAND];
  int k=0,counter=0,ej_lika,m,stycken,a;
  fil=fopen(&quot;land.dat&quot;,&quot;r&quot;);
  if(!fil){
    printf(&quot;ERROR open file!&quot;);
    exit(1);
  }
  fscanf(fil,&quot;%d&quot;,&amp;stycken);
  while(!feof(fil)){
     fscanf(fil,&quot;%s&quot;,&amp;Ttest[k].namn);
     k++;
  }
  fclose(fil);
  for(k=0;k&lt;=MAXLAND;k++) Ttemp[k].namn==NULL;
/' Can i do this different??*/
  for(k=0;k&lt;=stycken-1;k++){
    ej_lika=0;
    for(m=0;m&lt;=stycken-1;m++){
      if(strcmp(Ttest[k].namn, Ttemp[m].namn)!=0)  ej_lika++;
      if(ej_lika==stycken){
        strcpy(Ttemp[counter].namn, Ttest[k].namn);
        ej_lika=0;
        counter++;
        break;
       }
    }
  }
/*check the result.*/
  for(k=0; k&lt;counter; k++) printf(&quot;%s\n&quot;,Ttemp[k].namn);
  getch();   return 0;
}
</pre>
<p>Credit will begiven for clarity of the review as well as the
quality of the final code. As long as the code format is consistent
any format is acceptable and no credit will be given for any
specific choice. Good use of identifiers and suitable comments are
expected. The 'winner' (i.e. my sole choice) will be able to choose
a title from my collection of prize books.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
