this program is almost finished. The only problem is that when the user inputs quit quit, it should close the program. But it doesn't and it keeps repeating. I know that if I use it a single character (such as 'q') it works because I already tried it. But I want the program to detect that the user has input the string "quit". Could you help me with this? Thanks a lot!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FILENAME "sales.txt"
int main()
{
char firstName[41];
char itemSold[41];
FILE *salesFile;
salesFile = fopen(FILENAME, "w");
if( salesFile == NULL )
{
printf("Error opening file\n");
return 1;
}
printf("Please enter first name and item sold\n");
printf("Please quit quit to end\n");
printf("> ");
scanf("%40s %40s", firstName, itemSold);
while(firstName != "quit" && itemSold != "quit")
{
fprintf(salesFile, "%s %s\n", firstName, itemSold);
printf("> ");
scanf("%40s %40s", firstName, itemSold);
}
fclose(salesFile);
return 0;
}