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

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

 荐  火... [复制链接]
发表于 2021-1-16 20:32:26 | 显示全部楼层
零基础入门学习C语言封面
《零基础入门学习C语言》
小甲鱼 著
立即购买
long long int
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-16 21:50:26 | 显示全部楼层
查看答案
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-16 22:37:25 | 显示全部楼层
1
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-1-16 23:20:19 | 显示全部楼层
答案
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-1-16 23:28:20 | 显示全部楼层
0.不知道
1.4bit或者说一个字节
2.是
3.4
5.除了D都是错的
6.int
7.不知道
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-17 00:47:22 | 显示全部楼层
dsasdf
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-17 01:13:05 | 显示全部楼层
minhwu@minhwu-VirtualBox:~/minhui_test/C/s1e6$ gcc -Wall -lm test4.c -o test4
/usr/bin/ld: /tmp/ccwuxpu9.o: in function `main':
test4.c:(.text+0x33): undefined reference to `pow'
collect2: error: ld returned 1 exit status

这是什么错误啊
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-17 01:13:38 | 显示全部楼层
#include <stdio.h>
#include <math.h>

int main()

{
        unsigned long long sum = 0;

        unsigned long long  weight;

        unsigned long long temp;

        int i;


        for (i=0; i < 64; i++)
        {
                temp = pow(2, i);
                sum = sum + temp;
        }

        weight = sum / 25000;

        printf("舍罕王应该给予达伊尔%llu粒麦子\n", sum);
        printf("如果每25000粒麦子为1KG,那么应该给%llu公斤麦子\n", weight);


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

使用道具 举报

发表于 2021-1-17 15:22:37 | 显示全部楼层
1
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-1-17 15:23:09 | 显示全部楼层
0.long long int
1.char
2.不是
3.8
4.
5.C、D、F
6.unsigned int

0.

  1. #include <stdio.h>
  2. #include <math.h>

  3. int main()
  4. {
  5.         printf("%.0f",pow(1,2) + pow(2,3) + pow(3,4)\
  6.          + pow(4,5) + pow(5,6));
  7.         return 0;
  8. }
复制代码


1.

  1. #include <stdio.h>
  2. #include <math.h>

  3. int main()
  4. {
  5.         unsigned long long temp;
  6.         unsigned long long sum = 0;
  7.         unsigned long long weight;
  8.         int i;
  9.        
  10.         for (i=0;i<64;i++)
  11.         {
  12.                 temp = pow(2,i);
  13.                 sum = sum + temp;
  14.         }
  15.        
  16.         weight = sum / 25000;
  17.        
  18.         printf("舍汉王应该给予达依尔%llu粒麦子!\n",sum);
  19.         printf("如果每25000粒麦子为1kg,那么应该给%llu公斤麦子",weight);
  20.        
  21.         return 0;
  22. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-17 16:11:43 | 显示全部楼层
查看
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-1-17 23:14:04 | 显示全部楼层
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main()
{
    unsigned long long sum = 0;
    unsigned long long temp;
    unsigned long long weight;
    unsigned int i;

    for (i = 0; i < 64; i++)
    {
        temp = pow(2, i);
        printf("%lld\n", temp);
        sum = sum + temp;
        printf("%lld\n\n", sum);
    }

    weight = sum / 25000;


    printf("舍罕王应该给予达伊尔%lld粒麦子!\n", sum);
    printf("如果每25000粒麦子为1kg,那么应该给%lld", weight);

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

使用道具 举报

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

使用道具 举报

发表于 2021-1-18 00:33:11 | 显示全部楼层
加油奥里给
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-18 02:23:53 | 显示全部楼层
a
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2021-1-18 11:53:05 | 显示全部楼层
蟹蟹小甲鱼
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-18 11:53:48 | 显示全部楼层
123
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

使用道具 举报

发表于 2021-1-18 17:46:02 | 显示全部楼层
朕想知道
小甲鱼最新课程 -> https://ilovefishc.com
回复 顶 踩

使用道具 举报

发表于 2021-1-18 17:55:21 | 显示全部楼层
冲!
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-11-26 04:55

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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