<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
  <channel>
    <title>Udvikleren.dk - Seneste [2d] forum tråde</title>
    <description>De seneste forum tråde i [2d] på Udvikleren.dk</description>
    <link>http://www.udvikleren.dk/</link>
    <pubDate>Wed, 29 Apr 2026 06:36:40 GMT</pubDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Udvikleren.dk RSS Feeder</generator>
    <ttl>60</ttl>
    <item>
      <title>Skoleopgave i PHP(2d array)?</title>
      <description>&lt;b&gt;&lt;u&gt;Hej derude!&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Jeg har faaet en opgave ind af doeren, som jeg ikke lige kan gennemskue.&lt;br /&gt;Opgaven lyder saadan(engelsk):&lt;br /&gt;&lt;br /&gt;&lt;div class="codeboxheader" id="code_2057932021" onclick="ToggleCodeBox(this.id);"&gt;&lt;img id="code_2057932021_arrow" src="/images/icons/codeboxarrow_down.gif" alt="Fold kodeboks ind/ud" title="Fold kodeboks ind/ud" /&gt;Kode&amp;nbsp;&lt;/div&gt;&lt;pre id="code_2057932021code" style="border-top: 0px; display: none;"&gt;Write a php program to simulate a table of 30 marks for a number of modules on a course using a
2-dimensional sequential array. The columns will be Mark Number, ModuleCode, Module Name and
Mark . Your 4 modulecodes and module names are COM147 Database; COM140 Hardware; COM137
Maths &amp; COM177 Programming. The program will then print a table with all 30 rows generating
different modules, marks and summary values every time it is run.

The php program should:

Firstly allocate the values directly into the array ( $marks[ ][ ] ) within a for loop [array( ) - the array
function - should not be used]
- Mark Number should be assigned a number from 1 to 30
- Module Code should randomly assign one of the 4 module codes (use rand( ) function - see coin flip)
- Module Name should allocate the name of the randomly allocated module code (shown above)
- Mark should assign a randomly allocated mark between 0 &amp; 100 (use rand( ) function)

Secondly use another for loop (preferable nested for loops) to print the 2-D array of values into an html
table including a header row plus print

- The overall average mark to 1 decimal place
- The number of times each module is chosen
- The average mark for each module to 1 decimal place
- The % pass rate for each module to 1 decimal place:
i.e. (number of marks of 40 and over/total number of marks) * 100

N.B. $marks[0][0] is row1 and column 1; $marks[0][1] is row 1 column 2 etc
$marks[1][0] is row 2 column 1; $marks[1][1] is row 1 column 2 etc

When assigning values into the array you should put the for loop variable as the row number so that
each time round the loop your are moving to a different row.

the php function round(number, decimal places) allows a number to be given to a set number of
decimal places so round(9.461, 1) gives 9.5&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Jeg kan ikke lige gennemskue hvordan jeg skal goere?&lt;br /&gt;Min forvirring kommer af jeg skal bruge bracket 2d array og tildele i en for loekke.&lt;br /&gt;&lt;br /&gt;Er der nogle som kan pege mig i den rigtige retning?&lt;br /&gt;&lt;br /&gt;Mvh Alex</description>
      <link>http://www.udvikleren.dk/forum/39362/skoleopgave-i-php(2d-array)/</link>
      <pubDate>Fri, 28 Dec 2012 00:55:59 GMT</pubDate>
    </item>
  </channel>
</rss>