c++复习2006-12.ppt

c复习2006-12

* 一、语法 标识符: 由字母、数字和下划线三种字符组成,且必须以字母或下划线开头。 关键字不能作为用户定义的标识符。 用户定义标识符: 合法: char2 _abc a3 P1 不合法: int p[i] break 3a a+b class public 常量: 合法: \n \102 \t \72 不合法: ABC 1.2e0.5 M [] 编译预处理命令 文件包含: #include 当调用系统提供的资源时,需使用该命令.如,在调用库函数时,使用的文件包含命令如下: 字符串处理函数 需使用 #include “string.h” strlen(str) 如:strlen(“ \nabcd ”)的结果为5(不包含对‘\0’的统计) strlwr(str) strupr(str) strcpy(str1,str2) 如: char s1[30]=“abcd”; strcpy(s1+2,“123”); couts1; 输出结果为:ab123 strcat(str1,str2) strcmp(str1,str2) 需使用 #include “std

文档评论(0)

1亿VIP精品文档

相关文档