Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- void find(char **ADS, int NUM_ADS) {
- int i;
- puts("検索結果:");
- puts("-------------------------");
- for (i = 0; i < NUM_ADS; i++) {
- if (strstr(ADS[i], "sports") && !strstr(ADS[i], "bieber")) {
- printf("%s\n", ADS[i]);
- }
- }
- puts("-------------------------");
- }
- int main(void) {
- char *ADS[] = {
- "William: SBM GSOH likes sports, TV, dining",
- "Matt: DWM NS likes art,movies, theater",
- "Luis: SLM ND likes books, theater, art",
- "Mike: DWM DS likes trucks, sports and bieber",
- "Josh: SJM likes sports, movies and theater",
- "Jed: DEM likes theater, books and dining"
- };
- int NUM_ADS = sizeof(ADS) / sizeof(char **);
- find(ADS, NUM_ADS);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement