2011年5月30日
摘要: 字符串可以用字符数组与字符串变量两种方式来存储,效果类似。一、用字符数组来存储字符串:char st1[100],st2[100] ;//字符数组说明cin>>st1>>st2;long a,b;输入:hello, world则st1={‘h’,’e’,’l’,’l’,’o’,’,’,’\0’}st2={‘w’,’o’,’r’,’l’,’d’,’\0}字符’\0’为字符串结束标志1. 字符数组长度 strlen(st1); //如a=strlen(st1);b=strlen(st2); 则a=6,b=52. 字符数组比较 不能直接比较,st1>st2是错误的,要用 阅读全文
posted @ 2011-05-30 08:44 Angry Jerry 阅读(328) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2011-05-30 08:42 Angry Jerry 阅读(1) 评论(0) 推荐(0) 编辑