Files
CS50---Harvard/v1_search.c
T
2026-05-28 10:16:10 +00:00

33 lines
366 B
C

#include <cs50.h>
#include <stdio.h>
#include <string.h>
int main (void)
{
string strings [] = {"battleship", "boot", "cannon", "iron", "thimble", "top hat"};
string s = get_string("Strings: ");
for (int i = 0; i < 6; i++)
{
if (strcmp(strings [i], == s) == 0)
{
printf("Found\n");
return 0;
}
}
printf("Not found \n");
return 1;
}