编程练习
 通过试验的方法 试验整数上溢,浮点上溢下溢
// 3-x-1 --试验整数上溢,浮点上溢下溢
#include <stdio.h>
int main (void)
{
        int a = 2147483647;    //定义一个整型的最大值
       float        b = 1.0e+37f;   //定义一个浮点型最大值
       float        c = b * 1.0e+37f ;
       float        d = 1.0e-37;
       float        e = d / (1.0e+37);
      
       printf ("整数未溢出前的值%d 整数溢出后的值%d\n",a,a + 1);
       printf ("浮点数未上溢出前的值%e 浮点数上溢出前后的值%e\n",b,c);
       printf ("浮点数未下溢出前的值%e 浮点数下溢出前后的值%e\n",d,e);
}
 
编写一个程序要求输入一个ASCII码值(如66),然后输出相应的字符
 //3-x-2.c ----输入一个码值输出一个相应字符
#include <stdio.h>
int main (void)
{
       int a = 0 ;   //声明要输入的变量为一整数值
       printf ("请输入一个ASCII的码值\n");
       scanf ("%d",&a);
       printf ("您输的ASCII码值为%d与它相对应的符号为%c\n",a,a);
       return 0 ;
}
 
编写一个程序发出警报声,并打印下列文字:
Startled by the sudden sound, Sallyshouted, “By the Great pumpkin ,what was that!”
 
/* 3-x-3.c 输出Startled by the sudden sound, Sallyshouted, "By the Great pumpkin ,what was that!"*/
#include <stdio.h>
int main (void)
{
       printf ("\aStartled by the sudden sound, ");
       printf ("Sallyshouted,");
       printf ("\"By the Great pumpkin ,");
       printf ("what was that!\"\n");
}
编写一个程序,读入一个浮点数,并分别以小数开式和指数形式打印。输出应如同下面的格式 the input is 21.290000 or 2.129000e +001
// 3-x-4.c --- 输出应如同下面的格式 the input is 21.290000 or 2.129000e +001
#include <stdio.h>
int main (void)
{
       float a = 0 ;//声明要输入的数值类型
       printf ("请输入一浮点数");
       scanf ("%f",&a);
       printf ("您输入的浮点数值为:%.6f用小数形式为:%.6f用指数形式为:%e\n",a,a,a);
       return 0 ;
}

(这个好像有点不对)