正在加载图片...
#define false 然后,编写程序,其中 包含该头文件: # include a:thong maino Bint in=0 char str[801 gets(str) for(i=l; stri=0; 1++) if (iswhite(str=TRUE) n++ printf( has %d words",n) nt iswhite(char c) {if(c="|c=="nl|c="t) return TRUE return FALse; 93.条件编译 1.定义:当满足某条件时对一组语句进行编译,而当条件不满 足时则编译另一组语句 2.格式 # ifdef标识符 语句段; #else 语句段 #endif 含义是:当标识符被定义过(用# define定义),则编译#f到#lse 之间的程序段;否则编译#else到# endif之间的程序段 3格式二: # ifndef标识符 语句段 #else 语句段; #endif 4格式三: #if表达式 语句段#define FALSE 0 然后,编写程序,其中 包含该头文件: #include "a:\hong.h" main() {int i,n=0; char str[80]; gets(str); for(i=1;str[i]!='\0';i++) if (iswhite(str[i])==TRUE) n++; printf(“has %d words",n); } int iswhite(char c) { if(c==''||c=='\n'||c=='\t') return TRUE; else return FALSE;} 9.3. 条件编译 1.定义:当满足某条件时对一组语句进行编译,而当条件不满 足时则编译另一组语句。 2.格式一: #ifdef 标识符 语句段; #else 语句段; #endif 含义是: 当标识符被定义过(用#define 定义), 则编译#if 到#else 之间的程序段; 否则编译#else 到#endif 之间的程序段。 3.格式二: #ifndef 标识符 语句段; #else 语句段; #endif 4.格式三: #if 表达式 语句段;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有