#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t text[100];
wchar_t substring[40];
printf("\nEnter the string to be searched(less than 100 characters):\n");
fgetws(text, 100, stdin);
printf("\nEnter the string sought (less than 40 characters ):\n");
fgetws(substring, 40, stdin);
text[wcslen(text)-1] = L'\0';
substring[wcslen(substring)-1] = L'\0';
printf("\nFirst string entered:\n%S\n", text);
printf("\nSecond string entered:\n%S\n", substring);
int i;
for(i = 0 ; (text[i] = towupper(text[i])) ; i++);
for(i = 0 ; (substring[i] = towupper(substring[i])) ; i++);
printf("\nThe second string %s found in the first.",((wcsstr(text, substring) == NULL) ? "was not" : "was"));
return 0;
}
|