Create a program that uses the strstr() function to search the string \"When the
ID: 3846823 • Letter: C
Question
Create a program that uses the strstr() function to search the string "When the going gets tough, the tough stay put!" for the following occurrences (display each occurrence found to standard output): "Going" "tou" "ay put!* Build a program that uses an array of strings to store the following names: "Florida" "Oregon" "California" "Georgia" Using the preceding array of strings, write your own sort function to display each state's name order using the strcmp function. Modify the word Find game to include one or more of the following suggestions: Add a menu to the Word Find game that allows the user to select a level of difficulty, such as beginning, intermediate, and advanced. The number of seconds the user has to guess or the length of the text in which the user will look for words could determine the level of difficulty. Incorporate multiple words into the text areas. Track the player's score. For example, add 1 point for each word guessed correctly and subtract 1 point for each word guessed incorrectly.Explanation / Answer
#include<stdio.h>
#include<string.h>
void main() {
char s[5][20], t[20];
int i, j;
s[0] = "Florida";
s[1] = "Oregon";
s[2] = "California";
s[3] = "Georgia";
for (i = 1; i < 5; i++) {
for (j = 1; j < 5; j++) {
if (strcmp(s[j - 1], s[j]) > 0) {
strcpy(t, s[j - 1]);
strcpy(s[j - 1], s[j]);
strcpy(s[j], t);
}
}
}
getch();
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.