- 829 名前:デフォルトの名無しさん mailto:sage [2008/01/30(水) 20:26:33 ]
- #include <iostream>
#include <string.h> using namespace std; int main() { char str[256] = "<a href=\"localhost\">link</a>" "<a href=\"localhost\">link2</a>"; char *ptr; int i = 0; ptr = str; while(1) { ptr = strstr(ptr,"http://"); if(!ptr) break; ptr += 7; i++; } printf("http://の出現数は%dです。\n",i); return 0; } http://の出現回数を数えているのですが、 悪い点、改善点等のご指摘を下さい。
|

|