Note that there are some explanatory texts on larger screens.

plurals
  1. POlogic issue or something more?
    primarykey
    data
    text
    <p>My program simulates a video store. In my list there are multiple copies of some videos. If I try to rent a video and the first copy of that video in the list is already rented, my program fails to continue checking to see if the other copies are available (a film is available if custId is '0000'). Take a look at the text file from where the list gets its members for a better understanding of what i'm describing:</p> <p><img src="https://i.stack.imgur.com/Ntp6m.png" alt="enter image description here"></p> <p>Could anyone take a look and let me know if they spot an issue? Any help is appreciated, thanks.</p> <p><strong>Code from main</strong></p> <pre><code> try { int index = 0; bool found = false; while (!found) { if (strncmp(filmId,filmList.getAt(index).number,6) == 0 &amp;&amp; strncmp("0000",filmList.getAt(index).rent_id,5) == 0)//If that film is rented by NO customer { found = true;//customer can rent it strcpy(newItem.number,filmId);//copy filmId into newItem filmList.retrieve(newItem);//copy the struct in our orderedList with the same filmId/copy into newItem filmList.remove(newItem);//delete the struct with same filmId/copy as newItem from the orderedList strcpy(newItem.rent_id,custId);//update info in strcpy(newItem.rent_date,rentDate);// newItem to show strcpy(newItem.return_date,dueDate);// that it has been rented filmList.insert(newItem);//put NewItem into list, effectivily replacing the removed item. cout &lt;&lt; "Rent confirmed!" &lt;&lt; endl; } else { if (strncmp(filmId,filmList.getAt(index).number,6) &gt; 0 || strncmp("0000",filmList.getAt(index).rent_id,5) &gt; 0) { ++ index; } else { throw string ("Not in list"); } } } } catch (string s) { cout &lt;&lt; "\n***Failure*** " &lt;&lt; s &lt;&lt; endl; } </code></pre> <p>Let me know if more code is required from any other parts of the program. </p>
    singulars
    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.
 

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