I'm having a problem again with an endless loop... I'm confused with how to use toupper() and strcpy() together. If that can be done. Here's what I have:
Code:
puts("Enter employee department:");
scanf("%s", employee[i].dept);
strcpy(temp, employee[i].dept);
*temp = toupper(temp);
while (strcmp (temp, "SALES") != 0 || strcmp(temp, "PRODUCTION") !=0) {
puts("Two departments available: Sales or Production.");
puts("Choose one:");
scanf("%s", employee[i].dept);
*temp = toupper(employee[i].dept);
}
once I get in the loop, I can't get out even if I typr in the right input (sales or production)
I tried:
Code:
strcpy(temp, toupper(employee[i].dept));
but that doesn't work, it gives me a "pointer from integer without a cast" error... I tried to place a '*' before temp, ... that doesn't solve the problem!!
(I guess you got that I'm trying to make sure that the user is only able to type in either sales or production... )
So now I'm just really confused