Cod sursa(job #490305)
Utilizator | Data | 5 octombrie 2010 21:39:42 | |
---|---|---|---|
Problema | A+B | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <cstdio>
#include <regex.h>
int
match(const char *string, char *pattern)
{
int status;
regex_t re;
if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) {
return(0); /* report error */
}
status = regexec(&re, string, (size_t) 0, 0, 0);
regfree(&re);
if (status != 0) {
return(0); /* report error */
}
return(1);
}
char p[20];
int main()
{
p[0]='e';
p[1]='l';
p[2]='l';
p[3]='o';
return match("helo",p);
}