找回密码
 立即注册
楼主: 小甲鱼

[课后作业] S1E6:数据类型 | 课后测试题及答案

 荐  火... [复制链接]
发表于 2022-7-16 22:53:11 | 显示全部楼层
零基础入门学习C语言封面
《零基础入门学习C语言》
小甲鱼 著
立即购买
11
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-17 23:19:07 | 显示全部楼层
0.long long int 1.1个字节(布尔类型) 2.不是函数,是一个运算符 3.8bit 5.b e f 6.unsigned可以表示的更大(无符号,可以表示的更多)7.程序只有01,0表示flase,1表示true #include<stdio.h>
#include<math.h>
int main(){
        int a;
        a = pow(1,2)+pow(2,3)+pow(3,4)+pow(4,5)+pow(5,6);
        printf("1^2 + 2^3 + 3^4 + 4^5 + 5^6 = %d\n",a);
        return 0;
}#include<stdio.h>
#include<math.h>
int main(){
        unsigned long long int sum = 0;
        unsigned long long int weight = 0;
        unsigned long long int temp = 0;
        for(int i = 0; i < 64;i++){
                temp = pow(2,i);
                printf("temp = %d\n",temp);
                sum = sum+temp;
        }
        weight = sum/25000;
        printf("有%d粒麦子%d\n",sum);
        printf("%d公斤",weight);
        return 0;
}
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-18 10:19:05 | 显示全部楼层
23333
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-18 14:08:08 | 显示全部楼层
1
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-18 14:13:21 | 显示全部楼层
0.  long long int
1.  1bit
2.  不是
3.  8
4.  short int
5.  ABEF
6.  signed int
7.  程序只能依照某一个标准执行
0.  
#include<stdio.h>
#include<math.h>
int main()
{
        int a,b,c,d,e,result;
        a=pow(1,2);
        b=pow(2,3);
        c=pow(3,4);
        d=pow(4,5);
        e=pow(5,6);
        result=a+b+c+d+e;
        printf("%d\n",result);
        return 0;
}
1.  #include<stdio.h>
#include<math.h>
int main()
{
        double sum,temp,weight,i;
        for(i=0;i<64;i++);
        {
                temp=temp+i;
                sum=sum+temp;
        }
        weight=sum/25000;
        printf("舍罕王应该给予达依尔%d粒麦子!/n",sum);
        printf("如果每25000粒麦子为1kg,那么应该给%d公斤麦子!\n",weight);
        return 0;
}
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-18 17:36:16 | 显示全部楼层
1
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-18 20:22:19 | 显示全部楼层
What’s a Devante Susanna what’s不知道问题,出在哪去啊。
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-19 09:25:02 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-19 11:16:49 | 显示全部楼层
zhichi
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-19 19:54:46 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-19 22:58:00 | 显示全部楼层
查看参考答案!
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-20 06:27:32 | 显示全部楼层
1 bool
2 不是,它是一个运算符
3 32
4 布尔代数
5ef0 long long int

6unsigned int
7程序只有真假,不会模糊
#include<stdio.h>
#include<math.h>

int main()
{
        int result;
       
        result = pow(1,2)+pow(2,3)+pow(3,4)+pow(4,5)+pow(5,6);
        printf("result = %d\n",result);
       
               
                return 0;
       
}
#include<stdio.h>
#include<math.h>

int main()
{
                long long int sum;
                long int temp;
                int weight;
            short int i;
               
                for (i=0;i<64;i++)
                {
                                temp = pow(2,i);
                                sum = sum + temp;
                }
                weight = sum / 25000;
                printf("舍罕王应该给予达伊尔%d粒麦子!\n",sum);
                printf("如果每25000粒麦子为1kg,那么应该给%d公斤的麦子!\n",weight);
               
                return 0;
}
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-20 10:28:16 | 显示全部楼层
0.long long int
1.布尔类型  _Bool
2.是的
3.1
4.
5.A.i要用括号,E.int要加上括号 F.起码size和of要连起来
6.unsigned
7.

小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-20 16:13:46 | 显示全部楼层
1
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-20 20:39:45 | 显示全部楼层
123
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2022-7-21 11:34:57 | 显示全部楼层
嘿,亲爱的鱼油,每天都要过得开心哦^_^
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-21 12:10:47 | 显示全部楼层
小甲鱼 芥末蟀!
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-21 13:44:46 | 显示全部楼层
0,long long int
1,字节
2,是,判断数据类型或者表达式长度的运算符
3,8个
4,布尔,只有布尔加和布尔减
5,e和f
6,unsigned int因为第一位可以是数字,而int第一位用来存放符号
7,程序是安装规定的语法和编写的内容来运行的
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-21 14:50:35 | 显示全部楼层
0.long long int
1._Bool char
2.不是
3.8
4._Bool
5.BDEF
6.unsigned int
7.
0.
#include <stdio.h>
#include <math.h>

double x;
double y;
double a;

int main()
{
        x = 1;
        y = 2;
        a = 0;
        a = pow(x,y);
        x = 3;
        a = a + pow(y,x);
        y = 4;
        a = a + pow(x,y);
        x = 5;
        a = a + pow(y,x);
        y = 6;
        a = a + pow(x,y);
        printf("%.0f",a);
}
1.
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2022-7-21 16:12:43 | 显示全部楼层
error C2632: 'long' followed by 'long' is illegal
我用unsigned long long定义sum程序报错了,说long后面跟long是非法的
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|鱼C工作室 ( 粤ICP备18085999号-1 )

GMT+8, 2026-11-25 17:06

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表