摘要:
但用指针 char *p=NULL; p="computer";可以。 char a[3]; a[3]="oq"; error: invalid conversion from `const char*' to `char'|a[3]是char 而“oq”是char*,不能赋值--------------------------------------------------------------- char a[3]; a="oq";在c++中|error: ISO C++ forbids assignment o 阅读全文
posted @ 2014-01-20 22:43
zj一乐
阅读(211)
评论(0)
推荐(0)
摘要:
#include using namespace std;int main(){ char *p=NULL; p="com\0hputer"; while(*p){ cout using namespace std;int main(){ char *p=NULL; p="com0hputer"; while(*p){ cout << *p; p++; } return 0;}输出 com0hputer说明 字符串的0 其实是“0” 而不是 bool 的0 if('0'=="0") { ... 阅读全文
posted @ 2014-01-20 22:19
zj一乐
阅读(452)
评论(0)
推荐(0)
摘要:
#include using namespace std;int main(){ char *p=NULL; p="computer"; cout(p) 阅读全文
posted @ 2014-01-20 22:16
zj一乐
阅读(555)
评论(0)
推荐(0)
摘要:
//自己写的找零贪心算法#include using namespace std;int main(){ float mianer[]={100,50,10,5,1,0.5,0.1}; int fanan[]={0,0,0,0,0,0,0}; float qianshu; cout>qianshu; for(int i=0;i=mianer[i]) { qianshu-=mianer[i]; fanan[i]++; } } for(int i=0;i<7;i++) ... 阅读全文
posted @ 2014-01-19 08:44
zj一乐
阅读(649)
评论(0)
推荐(0)
摘要:
//参考书上的算法#include #define N 12#define V 100using namespace std;typedef struct box{int id;int boxsize;struct box* next;}BOX;void initboxlist(BOX ** H){ *H=(BOX*)malloc(sizeof(BOX)); (*H)->id=0; (*H)->boxsize=0; (*H)->next=NULL;}BOX* findbox(BOX* H,int vl,int v){ BOX* p=H; while(p !=... 阅读全文
posted @ 2014-01-18 23:18
zj一乐
阅读(428)
评论(0)
推荐(0)
浙公网安备 33010602011771号