Question: I have a problem with this code #include #include int main ( ) { char greeting [ 1 0 0 ] ; / / Array

I have a problem with this code #include
#include
int main(){
char greeting[100]; // Array to store the greeting input
int caseNumber =1; // Initialize the case counter
// Infinite loop to process each input line
while (1){
fgets(greeting, sizeof(greeting), stdin); // Read input line
greeting[strcspn(greeting,"
")]=0; // Remove newline character
// Stop processing if the input is "#"
if (strcmp(greeting,"#")==0){
break;
}
// Compare the greeting and print the corresponding language
if (strcmp(greeting, "HELLO")==0){
printf("Case %d: ENGLISH
", caseNumber);
} else if (strcmp(greeting, "HOLA")==0){
printf("Case %d: SPANISH
", caseNumber);
} else if (strcmp(greeting, "HALLO")==0){
printf("Case %d: GERMAN
", caseNumber);
} else if (strcmp(greeting, "BONJOUR")==0){
printf("Case %d: FRENCH
", caseNumber);
} else if (strcmp(greeting, "CIAO")==0){
printf("Case %d: ITALIAN
", caseNumber);
} else if (strcmp(greeting, "ZDRAVSTVUJTE")==0){
printf("Case %d: RUSSIAN
", caseNumber);
} else {
// If the greeting doesn't match any known language
printf("Case %d: UNKNOWN
", caseNumber);
}
caseNumber++; // Increment case counter for the next greeting
}
return 0;
} because all the outputs give Case 1: "And the respective language." But i need the outputs to be exactly like this Case 1: ENGLISH
Case 2: SPANISH
Case 3: GERMAN
Case 4: FRENCH
Case 5: ITALIAN
Case 6: RUSSIAN
Case 7: UNKWOWN
how do i modify that code to make it happen, pls help me

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!