第4堂课后作业

作业1:

Visual Studio 2012 主要用于C++、C#和VB语言的开发

······················································································分割线······················································································

作业2:

1,分析问题

根据问题来设计一种解决方案。

2编制程序

通过程序语言严格描述这个方案。

3编译

编译中发现错误,要分析原因,修改源程序。

4连接

连接中发生错误,要分析原因,修改源程序。

5调试运行

调试运行中发现问题分析本身有错误,要重新分析问题.

·································································分割线····················································································

作业3-1:

1) -abc    8) #micro   合法的变量名,在c语言中,只能由字母,数字和下滑线组成,且第一位只能是字母或下划线。

3) for    11) while       c语言中的基本字不能成为变量名

作业3-2:

(1):int的特点是保存整数,常用于年龄、月份等数据的保存。
(2):无符号整型unsigned int 和int类似,但只取正值。

(3):短整型 short int 在32位机中占2个字节

(4):长整型 long int 在32位机中占8个字节

(5): 无符号的长整型的最高位不代表正负,所以它的大小比普通长整大,但同时也失去了表示负数的功能

(6): 字符型 char 表示字符串
(7):无符号字符型 unsigned char   unsigned是无符号字符,只有正没有负,char是8位,是0~255

(8) :单精度 float   float的精度是6位有效数字,取值范围是10的-38次方到10的38次方,float占用4字节空间
(9): 双精度double   double的精度是15位有效数字,取值范围是10的-308次方到10的308次方,double占用8字节空间

(10) 长双精度 long double   long double的精度不少于double的精度,就像int和long int一样

····································································分割线············································································

作业4:

#include<stdio.h>
void main()
{
 char tip[11]="yanhaofeng";
  printf("%c %c\n",tip [0],tip[3]);
}
效果图

···················································································································································
作业5:

#include <stdio.h>

int main()

{

printf("%d\n",139133);

printf("%f\n",3.1415926);

}

作业6

6-1

(1):#include<stdio.h>
void main()
{
 int x;
 x= 25 + 0125;
printf("x=%d",x);
}

(2)#include<stdio.h>
void main()
{
 int x;
 x=24 * 3 / 5 + 6;
printf("x=%d\n",x);
}
(3)#include<stdio.h>
void main()
{
 int x;
 x=  36 + - (5 - 23 ) / 4;
printf("x=%d\n",x);
}
(4)#include<stdio.h>
void main()
{
 int x;
 x= 35 * 012 + 27 / 4 / 7 * (12 - 4);
printf("x=%d\n",x);
}
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
6-2
(1)#include<stdio.h>
#include<math.h>
void main()
{
 int x;
 x=3 * (2L + 4.5f) - 012 + 44 ;
printf("x=%d\n",x);
}
(2)#include<stdio.h>
#include<math.h>
void main()
{
 int x;
 x=3 * (int)sqrt(144.0);
printf("x=%d\n",x);
}
(3)#include<stdio.h>
#include<math.h>
void main()
{
 int x;
 x=cos(2.5f + 4) - 6 *27L + 1526 - 2.4L ;
printf("x=%d\n",x);
}
 
由浮点型转换为整型
·································································································分割线·····················································································
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值