135c語言
發布時間: 2025-08-16 22:38:21
A. C語言定義一個函數,判斷字元串中是否包含另一個子串!!!!!!急
調用strstr()函數就可以實現
#include<string.h>
#include<stdio.h>
intmain()
{
chars[]="12345678";
chars1[]="135";
chars2[]="567";
if(strstr(s,s1))
{
printf("ok ");
}
else
{
printf("no ");
}
//--以上顯示no
if(strstr(s,s2))
{
printf("ok ");
}
else
{
printf("no ");
}
//--以上顯示ok
return0;
}
熱點內容