Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since this is an assignment I don't want to just give away any answers, but here is stuff that should help.</p> <p>I read your assignment and I don't see the word dynamic used anywhere. This means you can just create the array of size 50 to start.</p> <pre><code>// non dynamic array allocation: assignments assign[50]; // dynamic allocation containers vector&lt;assignments&gt; assign; // array list list&lt;assignments&gt; assign; // linked list queue&lt;assignments&gt; assign; // queue list, useful with insertion sort </code></pre> <p>To parse the input data I recommend <a href="http://www.cplusplus.com/reference/istream/istream/getline/" rel="nofollow"><code>getline</code></a> with <a href="http://www.cplusplus.com/reference/cstring/strtok/?kw=strtok" rel="nofollow"><code>strtok</code></a> to break the line into the proper data.</p> <p>Example:</p> <pre><code>int linelength = 256; // don't forget the +1 for end of string terminator char *whitespaces = " \t" // \n and \0 will never be part of the token based on getline char line[256]; // or some other safe number length char *token; // no need to define size inputstream.getline(line, 256); token = strtok(line, whitespaces); // save token to correct location token = strtok(NULL, whitespaces); // save token to correct location token = strtok(NULL, whitespaces); // save token to correct location // ... </code></pre> <p>Just don't expect to use <code>line</code> after <code>strtok</code>s.</p> <p>As for your <code>ReadFile</code> function, I would give it the input stream and have it return one of the dynamic containers. I try to minimize how often I modify parameters.</p> <pre><code>vector&lt;assignment&gt; load(istream) { // stuff like the second block of code goes here return assign; } </code></pre> <p>Hope this helps.</p> <p>Thanks,</p> <ul> <li>Will</li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload