|
-
Feb 12th, 2001, 05:55 PM
#1
Thread Starter
Hyperactive Member
I have a project due today for school, and it runs ok but repeats the question 2x, what am I doing wrong????
#include <iostream.h>
#include <ctype.h>
#include <string.h>
void main()
{
//Declare and initialize variables
float meShip = (float) 25.00; //Accumulator for ME
float txShip = (float) 30.00; //Accumulator for TX
float njShip = (float) 32.50; //Accumulator for NJ
short meCount = 0; //Counter for ME
short txCount = 0; //Counter for TX
short njCount = 0; //Counter for NJ
short errCt = 0; //Error Count
char state[3] = "";
while (state != "XX")
{
//enter input
cout << "Enter State where items are to be shipped (ME, TX or MJ) or press XX to end: " <<endl;
cin.getline(state, 3);
state[3] = toupper(state[3]); //Change to upper case
if (stricmp(state,"ME") == 0)
{ meCount = (meCount +1); }
else if (stricmp(state, "TX") == 0)
{ txCount = (txCount +1); }
else if (stricmp(state, "NJ") == 0)
{ njCount = (njCount +1);}
else if (stricmp(state, "xx") == 0)
{ cout << "Number of Entries in ME: " << meCount<< " Total Amount: $" << float(meCount * meShip) << endl;
cout << "Number of Entries in TX: " << txCount << " Total Amount: $" << float(txCount * txShip) << endl;
cout << "Number of Entries in NJ: " << njCount << " Total Amount: $" << float(njCount * njShip) << endl;
cout << "Number of Invalid entries: " << errCt << endl; }
else
errCt = (errCt +1);
}//End While
} //End of main
Please help!
Thanks!
Lee
 Mahalo 
VB6(SP5), VC++, COBOL, Basic, JAVA
MBA, MCSD, MCSE, A+
Computer Forensics
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|