I used the strcmp() function, but now the subroutine never runs true. The if statement doesn't seem to be effective. I tried doing the following:
if(!strcmp(*vendorName, "q") || !strcmp(*vendorName, "Q"))
if(!strcmp(vendorName[0], "q") || !strcmp(vendorName[0], "Q"))
but then I got syntax errors.
Not sure what's wrong with time..
bool getVendor(data & adata)
{
char vendorName[MAX_LEN];
char phoneNum[MAX_LEN];
char productType[MAX_LEN];
int eventNum;
char events[MAX_LEN];
cout << "\nPlease enter information about the winery: " << endl;
getString("\tVendor name(type q to quit): ", vendorName);
if(!strcmp(vendorName, "q") || !strcmp(vendorName, "Q"))
{
getString("\tPhone number: ", phoneNum);
getString("\tType of product: ", productType);
eventNum = getInt("\tThe amount of events: ");
getString("\tName(s) of events: ", events);
adata.setVendorName(vendorName);
adata.setPhoneNum(phoneNum);
adata.setProductType(productType);
adata.setEventNum(eventNum);
adata.setEvents(events);
return true;
}
return false;
}
void getString(char * prompt, char * input)
{
cout << prompt;
cin.get(input, MAX_LEN, '\n');
cin.ignore(100, '\n');
}