易截截图软件、单文件、免安装、纯绿色、仅160KB

《C程序设计语言》读书笔记20091106

     书中有几个问题有点模糊。记录一下。
    
Answer to Exercise 1-7
Write a program to print the value of EOF .
 
#include <stdio.h>
 
int main(void)
{
  printf("The value of EOF is %d\n\n", EOF);
 
  return 0;
}
EOF在stdio.h中的定义为#define EOF (-1)
其中()被忽略,只使用-1。


相关文档:

C_关系和逻辑运算

 源码:
# include <stdio.h>
 
int main()
{
    /* 定义一个整数类型的变量,用来存放后面算式的值 */
    int logic;    
 
    int a = 1;
    int b = 2;
    int c = 3;
 
&n ......

C_运用do

 源码:
# include <math.h>
# include <stdio.h>    /* 数学函数库 */
 
int main()
{
    /* 用s表示多项式的值,用t表示每一项的值 */
    double s, t, x; // 此处用双精度声明变量
    int n;
    printf ......

C_定义字符型二维数组实现简单的编辑器

 源码:
# include <stdio.h>
/* 宏定义 */
# define MAX 100
# define LEN 80
 
/* 一个非常简单的文本编辑器 */
int main()
{
    char text[MAX][LEN];  // 定义字符型数组
    register int t, i, j;    /* 定义三个寄存器变量 */
  ......

C_各种数组的初始化实例

 源码:
# include <stdio.h>
 
int main()
{
    /* 有尺寸 */
    /* 一维整形数组初始化 */
    int  array1[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
    /* 一维字符型数组初始化,最后一个元素自动添加为‘/0 ......

C_综合使用数组实现简单的学生成绩管理系统

 源码:
/* 学生成绩查询系统 */
# include <stdio.h>
# include <stdlib.h>
 
int main( )
{
    int select;
    int i, j;
    int score[5][7];
    int average = 0;
    int sum = 0;
  &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号