《面向对象程序设计C++》课件1第2章 面向过程程序设计概述.pptVIP

  • 7
  • 0
  • 约3.2万字
  • 约 155页
  • 2023-11-14 发布于广东
  • 举报

《面向对象程序设计C++》课件1第2章 面向过程程序设计概述.ppt

* * 5.阅读下面的程序,直接写出程序运行结果。 #includeiostream using namespace std; int main() { int *ir; int i; ir=i; i=17; coutint i=iendl; coutint ir=*irendl; return 0; } * * 6.阅读下面的程序,直接写出程序运行结果。 #includeiostream using namespace std; int fun(char *s); int main() { coutfun(hello); return 0; } int fun(char *s) { char *t=s; while(*t!=\0) t++; return(t-s); } * * * * * §2.3.8.2 字符串变量赋值 使用字符串变量可以直接使用赋值运算符给字符串变量赋值。 在赋值的过程中不必关心赋值的两个字符串的长度是否一致,字符串变量的长度随字符串的长度改变而改变。 字符串变量只存储字符串本身的字符,而不包括结束符‘\0’ 。 还可以用数组的方式对字符串变量中的某个字符进行操作 。 str1 = Hello!; str1 = str2;

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档