摘要: #include #include #include using namespace std;int minValue(int a,int b,int c){ int min=a; if(bpAEnd) { if(pBBegin>pBEnd) return 0; else return pBEnd-pBBegin+1; } if(pBBegin>pBEnd) { if(pABegin>pAEnd) return 0; else ... 阅读全文
posted @ 2013-07-06 19:11 hunterzhang 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std;typedef struct student{ int data; struct student *next;}node;node *head;node *creat(){ node *head,*p,*s; int x,cycle=1; head=(node *)malloc(sizeof(node)); p=head; while(cycle) { if(scanf("%d",&x)!=EOF) ... 阅读全文
posted @ 2013-07-04 15:49 hunterzhang 阅读(170) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int main(){ int b=3; int arr[]={6,7,8,9,10}; int *ptr=arr; *(ptr++)+=123; cout<<*ptr<<' '<<*(++ptr)<<endl; return 0;}输出结果为:8 8注意:printf和cout一样都是从右到左压栈的。 阅读全文
posted @ 2013-07-02 15:51 hunterzhang 阅读(406) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;void test1(){ int a,x; for(a=0,x=0;a<=1&&!x++;a++) a++; cout<<a<<" "<<x<<endl;}void test2(){ int a,x; for(a=0,x=0;a<=1&&!x++;) a++; cout<<a<<" "<<x<<endl;}int main(){ test1(); test2 阅读全文
posted @ 2013-07-02 15:39 hunterzhang 阅读(150) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int func(int x) //函数的关键代码{ int count=0; while(x) { x=x&(x-1); count++; } return count;}int m... 阅读全文
posted @ 2013-07-02 15:13 hunterzhang 阅读(231) 评论(0) 推荐(0) 编辑