摘要: #include <iostream>#include <string.h>using namespace std;float add(float m,float n){return m+n;}float dec(float i,float j){return i-j;}int main(){float (*p)(float,float);float a,b;char c;cin>>a>>c>>b;switch(c){case '+':p = add;break;case '-':p = dec;bre 阅读全文
posted @ 2011-12-03 23:12 rookieeeeee 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string.h>using namespace std;char b[80];char *result = b;char *convert(char *p1){// char *result;// char b[80];// result = b;unsigned short temp = strlen(p1);unsigned short i = temp - 1;p1 += i;for(int j = temp;j > 0; j--){*result++ = *p1--;}*result +=  阅读全文
posted @ 2011-12-03 22:46 rookieeeeee 阅读(148) 评论(0) 推荐(0) 编辑
摘要: //越来越强啦 ^-^#include <iostream>#include <string.h>using namespace std;int findAlpha(char *p1,char *p2){unsigned short n1 = strlen(p1);unsigned short n2 = strlen(p2);int i,j;for (i = 0; i < n1; i++){unsigned short flag = i;for (j = 0;j < n2; j++){if (p1[flag] == p2[j]){flag++;if (j = 阅读全文
posted @ 2011-12-03 21:24 rookieeeeee 阅读(135) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string.h>using namespace std;// void swap(int *p1,int *p2)// {// int temp;// temp = *p1;// *p1 = *p2;// *p2 = temp;// }void swap(int &p1,int &p2){int temp;temp = p1;p1 = p2;p2 = temp;}int main(){int a = 1,b = 2;/*swap(&a,&b);*/swap(a,b);cout&l 阅读全文
posted @ 2011-12-03 20:45 rookieeeeee 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 指针方式:#include <iostream>#include <string.h>using namespace std;void fun(char *aa){int num = strlen(aa);char b[5];for(int i = 0; i < num+1; i++){b[i] = aa[i];}cout<<strlen(aa)<<endl<<sizeof(aa)<<endl<<sizeof(*aa)<<endl;/*b[4] = '\0';*/cout< 阅读全文
posted @ 2011-12-03 14:53 rookieeeeee 阅读(190) 评论(0) 推荐(0) 编辑