#include <stdio.h> #define Num 20 int power(int base,int n) { int p = 1; int i; for(i = 0;i < n;i++) p = p*base; return p; } int main() { int base = 2,n = Num; int i; for(i = 0;i < n;i++) printf("%2d %-6d\n",i,power(base,i)); return
Implement strstr() 实现strstr函数功能 whowhoha@outlook.com Question: Implement strstr(). Returns the index of the first occurrence of needle in haystack, or –1 if needle is not part of haystack. int strStr(string haystack, string needle) { for (int i = 0;