第四章 最简单的C程序设计
- 格式:ppt
- 大小:164.00 KB
- 文档页数:23


promotion of employment, form a reasonable and orderly pattern of income distribution, build a more fair and sustainable social security systems, medical and health system reform. The plenary, innovation of social governance, must focus on the maintenance of fundamental interests of the overwhelming majority of the people, maximize factors, enhance social development, improving social governance, the interests of national security, ensure that the people live and work, social stability and order. o improve social governance, stimulating social organization, innovative and effective system of preventing and resolving social conflicts, improving the public security system, set up the National Security Council, national security systems and national security strategy to ensure national security. Plenary session, the construction of ecological civilization, you must establish systems of ecological system, using the system to protect the ecological environment. o improve naturalresources asset property right system and use control, red line of delimitation of ecological protection, resources paid use system and ecological compensation system in ecological environment protection management system reform. Plenary session, centering on building a listening party command, can win and having a fine style of the people's army, a strong army under the new situation of the party Goals, restricting the development of national defense and army building is solved outstanding contradictions and problems, innovation and development of military theory, enhance military strategic guidance, improve the military strategy in the new period, building a modern military force system with Chinese characteristics. o deepen the adjustment of personnel system reform in the army, military policy and system reform, promote the development of military and civilian integration depth. Plenary session stressed that comprehensive reform must be to strengthen and improve theparty's leadership, give full play to the core role of the party commands the overall situation and coordinating all parties, improving the party's leading water ... Margin. Challenged the leadership of the Communist Party of China, Marxism-Leninism and Mao Zedong thought by Deng Xiao-ping's flag, replaced by three representatives and the harmonic society. The former Communist Party spirit and social cohesion point of almost all political makeover. Characteristics of socialism public ownership is shifting to private ownership, planned regulation and market regulation, the proletarian regime controlled by the elite. Of universal equality, fairness and basic principles of distribution system is socialist society, however after economic monopolized by powerful, vested interests growemployers do not have the same status, hardly seems fair social distribution. State key protection of capital interests rather than the interests of citizens, had been hits the bottom of the proletariat
实验三 最简单的C程序设计
1.实验目的
(1)掌握C语言中使用最多的一种语句——赋值语句的使用方法。
(2)掌握各种类型数据的输入输出方法,能正确使用各种格式转换符。
2.实验内容和步骤
(1)通过下面的程序掌握各种格式转换符的正确使用方法。
① 输入以下程序:
#include
void main()
{
int a, b;
float d,e;
char c1,c2;
double f,g;
long m,n;
unsigned int p,q;
a=61;b=62;
c1='a';c2='b';
d=3.56;e=-6.87;
f=3157.890121;g=0.123456789;
m=50000;n=-60000;
p=32768;q=40000;
printf("a=%d,b=%d\nc1=%c,c2=%c\nd=%6.2f,e=%6.2f\n",a,b,c1,c2,d,e);
printf("f=%15.6f,g=%15.12f\nm=%ld,n=%ld\np=%u,q=%u\n",f,g,m,n,p,q);
}
② 运行此程序并分析结果:
③ 在此基础上,将程序第9~14行改为:
a=61;b=62;
c1=a;c2=b;
f=3157.890121;g=0.123456789;
d=f;e=g;
P=a=m=50000;q=b=n=-60000;
运行程序,分析结果:
④ 改用scanf函数输入数据而不用赋值语句,scanf函数如下:
scanf("%d,%d,%c,%c,%f,%f,%lf,%lf,%ld,%ld,%u,%u",&a,&b,&c1,&c2,&d,&e,&f,&g,&m,&n,&p,&q);
输入的数据如下:
61,61,a,b,3.56,-6.87,3157.890121,0.123456789,50000,-60000,37678,40000(回车)
第四章 分支结构程序设计
课 题 关系运算符
教 学
目 的 1、掌握实现选择结构的两个运算符
2、运算符表达式的计算
教 材
分 析 教学重点 关系运算符及运算
教学难点 表达式的计算与应用
课时安排 1+1习题课 教学方法 讲授与演示法相结合讨论法 教具 计算机、投影仪
教
学
内
容
及
过
程
设
计 一 新课引入
上一次课已经介绍了程序基本结构之一,但在大多数情况下都要用到选择结构
而选择的前提是按一定的逻辑条件进行的。
二、新授
一、关系运算符与关系表达式
1、关系运算符:< <= > >= = = ! =
优先级:< <= > >= 高于 = = !=
关系运算符低于算术运算符,高于赋值运算符
2、关系表达式:用关系运算符将两个表达式(可以是算术表达式或
关系表达式,逻辑表达式,赋值表达式,字符表达式)连接起来的式子。
关系表达式求值:关系成立,值为1;关系不成立,值为0
C语言中没有专用的逻辑值,1代表真,0代表假
例:a>b,a+b>b+c,(a=3)>(b=5),’a’<‘b’,(a>b)>(b
关系表达式的值是一个逻辑值,即“真”或“假”。
例:关系表达式”a>b”的值为“真”,表达式的值为1。
一、逻辑运算符与关系表达式
1、逻辑运算符及其优先次序
(1)&& (逻辑与) 相当于其他语言中的AND
(2)|| (逻辑或) 相当于其他语言中的OR
(3)! (逻辑非) 相当于其他语言中的NOT
例:a&&b 若a,b为真,则a&&b为真。
a||b 若a,b之一为真,则a||b为真。
!a 若a为真,则!a为假。
优先次序:自左向右运算
!(非)->&&()->||()
逻辑运算符中的“&&”和“||”低于关系运算符,“!”高于算 术运算符
-1-凯里学院C语言程序设计实验报告×××××专业××年级××班,学号××××××姓名××成绩合作者实验日期年月日指导教师评阅日期年月日
实验三最简单的C程序设计
一、实验目的:1、掌握C语言的数据类型和变量的声明。
2、掌握不同类型数据之间赋值的规律。
3、掌握C语言的运算符和表达式的使用。
4、熟悉C程序的编辑、编译、连接和运行的过程。
二、实验内容:
①输人程序:#include
voidmain()
{
inta,b;
floatd,e;
charc1,c2;
doublef,g;
longm,n;
unsignedintp,q;
a=61;b=62;
c1='a';c2='b';
d=3.56;e=-6.87;
f=3157.890121;g=0.123456789;
m=50000;n=-60000;
p=32768;q=40000;
printf("a=%d,b=%d\nc1=%c,c2=%c\nd=%6.2f,e=%6.2f\n",a,b,c1,c2,d,e);
printf("f=%15.6f,g=%15.6f\nm=%ld,n=%ld\np=%u,q=%u\n",f,g,m,n,p,q);
}
②运行此程序并分析结果(2)按习题4.8要求编写程序
题目为:
设圆半径r=l.5,圆柱高h=3,求圆周长、圆面积、圆球表面积、圆球体积、圆柱体积。
用scanf输人数据,输出计算结果口输出时要有文字说明,取小数点后两位数字。
程序:
三、实验步骤:
①输人程序:#include装
订
线
装
订
线-2-voidmain()
{
inta,b;
floatd,e;
charc1,c2;
doublef,g;
longm,n;
unsignedintp,q;
a=61;b=62;
c1='a';c2='b';
d=3.56;e=-6.87;
f=3157.890121;g=0.123456789;
m=50000;n=-60000;
p=32768;q=40000;
printf("a=%d,b=%d\nc1=%c,c2=%c\nd=%6.2f,e=%6.2f\n",a,b,c1,c2,d,e);