zoukankan      html  css  js  c++  java
  • 《C语言程序设计》实验报告(一)

    C程序设计实验报告

    实验项目:课堂练习1-3-2,1-3-3,1-3-4,2-3-1,2-3-2

    姓名:余永祥       实验地点:家          实验时间:2020年2月25日

    一、实验目的与要求

    1.了解C语言程序设计的基础

    2.进行一些简单程序的编写任务

    二、实验内容

    1、实验练习:

    实验1-3-2:

    #include<stdio.h>
    main()
    {
        int a,b,c,d;
        printf("Please enter a,b:");
        scanf("%d %d",&a,&b);
        c=a+b;
        d=a*b;
        printf("c=%d",c);
        printf("d=%d",d);
    }

    出现问题:无

    解决方法:无

    2、实验练习:

    实验1-3-3:

    #include<stdio.h>
    main()
    {
        printf("*
    ");
        printf("**
    ");
        printf("***
    ");
        printf("****
    ");
        printf("*****
    ");
    }

    出现问题:无

    解决方法:无

    3、实验练习:

    实验1-3-4:

    #include<stdio.h> 
    main()
    {
        printf("Data Types and Sizes:
    ");
        printf("long:%d
    ",sizeof(long));
        printf("unsigned:%d
    ",sizeof(unsigned));
        printf("double:%d
    ",sizeof(double));
    }

    出现问题:名词拼写出错

    解决方法:多加熟悉

    4、实验练习:

    实验2-3-1:

    #include<stdio.h>
    #include<math.h>
    main()
    {
        float a,b;
        double x;
        printf("Please enter a,b:
    ");
        scanf("%f %f",&a,&b); 
        x=(b+sqrt(b*b+2*a))/(a-b);
        printf("x=%.2f",x);
    }

    出现问题:1.sqrt函数的运用较生疏,且不清楚要添加新的头函数<math.h>

                        2.对数字的类型输入还有问题

    解决方法:向同学询问后清楚了相应的用法,以及了解头函数的意义

    5、实验练习:

    实验2-3-2:

    #include<stdio.h>
    main()
    {
        double r,h,S,V;
        printf("Please input r,h:");
        scanf("%lf %lf",&r,&h);
        S=r*r*3.14;
        V=r*r*3.14*h/3;
        printf("底面积=%.2f",S); 
        printf("体积=%.2f",V);
    }

    出现问题:对数字的类型不理解

    解决方法:对课件再次学习,理解int,double,foalt的意义

    三、实验小结(在本次实验中收获与不足)

    收获:对一些基础的程序有了理解,熟悉了一些C语言的用法

    不足:需要熟悉一些关键字的不同用法,需要熟悉数字的类型,减少错误

  • 相关阅读:
    NetBeans 时事通讯(刊号 # 52 Apr 15, 2009)
    Linux 3.8.1 电源管理之OMAP Clock Domain分析
    基础架构部_超大规模数据平台架构师(上海)
    C Programming/Pointers and arrays Wikibooks, open books for an open world
    这个帖子介绍了关于structure和及struct arrary 作为参数 传递
    thinking point
    velocity
    枫芸志 » 【C】int与size_t的区别
    Pointers and Text Strings
    comp.lang.c Frequently Asked Questions 非常 好
  • 原文地址:https://www.cnblogs.com/GZ-1128-XZ/p/12380516.html
Copyright © 2011-2022 走看看