Serendipity booksellers software program C++
<p>this is a project I'm working on which comes from the book I'm using to learn C++ - "Starting out with C++". I'm having a problem with the cashier portion of the project at the moment. It asks the user to enter the date, quantity, isbn, title, and price of the book. Then, it asks the user if they wish to enter another book. Regardless of whether they type "y" or "n" it continues to the next part of the program. I don't really know why the for loop doesn't repeat after I type "y" to enter another book. Also, the date is coming out with garbage at the end when it is displayed, that's another thing I need to fix. Any help would be appreciated. There is definitely more problems but the main problem is in the cashier function in the first for loop. I didn't include the whole program because it's very long. </p>

<pre><code>/*
 *  mainmenu.cpp
 *  Serendipity Booksellers software
 *
 *  Created by Abraham Quilca on 9/5/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */


#include&lt;iostream&gt;
#include&lt;iomanip&gt;
#include&lt;cstring&gt;
#include"mainmenu.h"
using namespace std;

char bookTitle[20][51],
 isbn[20][14],
 author[20][31],
 publisher[20][31],
 dateAdded[20][11];
int qtyOnHand[20];
double wholesale[20];
double retail[20];;

int main()
{
    int choice;

do
{
    cout &lt;&lt; "\t\t   Serendipity Booksellers"&lt;&lt; endl;
    cout &lt;&lt; "\t\t\t  Main Menu" &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "\t\t1. Cashier Module" &lt;&lt; endl;
    cout &lt;&lt; "\t\t2. Inventory Database Module" &lt;&lt; endl;
    cout &lt;&lt; "\t\t3. Report Module" &lt;&lt; endl;
    cout &lt;&lt; "\t\t4. Exit" &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "\t\tEnter your choice: ";
    cin &gt;&gt; choice;
    cout &lt;&lt; endl;
    switch (choice)
    {
        case 1:
            cashier();
            break;
        case 2:
            invmenu();
            break;
        case 3:
            reports();
            break;
        case 4:
            continue;
            break;
        default:
            cout &lt;&lt; "\t\tPlease enter a number in the range 1-4." &lt;&lt; endl &lt;&lt; endl;
    }
}   
while(choice != 4);
cout &lt;&lt; "\t\tYou selected item 4." &lt;&lt; endl;
return 0;
}

// Cashier function

void cashier()
{
    char again;
    char date[8];
    int quantity[20] = {0};
    char ISBN[20][20] = {0};
    char title[20][40] = {0};
    float price[20] = {0}, bookTotal[20] = {0}, subtotal, total, tax;
    const float tax_rate = .06;

    cout &lt;&lt; "Serendipity Booksellers" &lt;&lt; endl;
    cout &lt;&lt; " Cashier Module" &lt;&lt; endl &lt;&lt; endl;

    for(int count = 0; count &lt; 20; count++)
    {
        cout &lt;&lt; "Date: ";
        cin &gt;&gt; date;
        cout &lt;&lt; "Quantity of Book: ";
        cin &gt;&gt; quantity[count];
        cout &lt;&lt; "ISBN: ";
        cin &gt;&gt; ISBN[count];
        cout &lt;&lt; "Title: ";
        cin.ignore();
        cin.getline(title[count], 40);
        cout &lt;&lt; "Price: ";
        cin &gt;&gt; price[count];
        bookTotal[count] = quantity[count] * price[count];
        subtotal += price[count];
        cout &lt;&lt; "Would you like to enter another book? (Y/N) ";
        cin &gt;&gt; again;
        if(again == 'N' || 'n')
            count = 21; // This line will end the for loop
    }
    // Calculating tax and total
    tax = subtotal * tax_rate;
    total = subtotal + tax;

    cout &lt;&lt; "\n\nSerendipity Booksellers" &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "Date:" &lt;&lt; date &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "Qty\t ISBN\t\t "
        &lt;&lt; left &lt;&lt; setw(40) &lt;&lt; "Title" &lt;&lt; "Price\t Total" &lt;&lt; endl
        &lt;&lt;     "-------------------------------------------------------------------------------"
        &lt;&lt; endl &lt;&lt; endl;
    for(int count = 0; count &lt; 20; count++)
    {
        cout &lt;&lt; quantity[count] &lt;&lt; "\t " &lt;&lt; ISBN[count] &lt;&lt; "   " &lt;&lt; left &lt;&lt; setw(40) &lt;&lt; title[count] 
        &lt;&lt; setprecision(2) &lt;&lt; fixed &lt;&lt; "$" &lt;&lt; setw(6) &lt;&lt; price[count] &lt;&lt; " $" &lt;&lt; setw(6) &lt;&lt; bookTotal[count]
        &lt;&lt; endl &lt;&lt; endl;
    }
    cout &lt;&lt; "\t\t\t Subtotal" &lt;&lt; "\t\t\t\t         $" &lt;&lt; setw(6) &lt;&lt; subtotal &lt;&lt; endl;
    cout &lt;&lt; "\t\t\t Tax" &lt;&lt; "\t\t\t\t                 $" &lt;&lt; setw(6) &lt;&lt; tax&lt;&lt; endl;
    cout &lt;&lt; "\t\t\t Total" "\t\t\t\t                 $" &lt;&lt; setw(6) &lt;&lt; total &lt;&lt; endl &lt;&lt; endl;
    cout &lt;&lt; "Thank You for Shopping at Serendipity!" &lt;&lt; endl &lt;&lt; endl;
}
</code></pre>
