首页 > 其他分享 >实验1.0

实验1.0

时间:2023-10-05 21:11:24浏览次数:29  
标签:main 源代码 1.0 int 实验 printf include

1.实验任务1

源代码

#include<stdio.h>
int main()
{
  printf(" o o\n");
  printf("<H> <H>\n");
  printf("I I I I\n");
  getch();

  return 0;
}

运行结果

 2.实验任务2

源代码

#include<stdio.h>

int main() 
{    
    float a, b, c;
    scanf("%f%f%f", &a, &b, &c);

    if (a + b > c && a + c > b && b + c > a)
        printf("能构成三角形\n");
    getchar();
    else
        printf("不能构成三角形\n");
        getchar();

    return 0;

}

运行结果

 

 3.实验任务3

源代码

#include<stdio.h>
int main() {
    char ans1, ans2;
    printf("每次课前认真预习、课后及时复习了没?(输入y或Y表示有,输入n或N表示没有):");
    ans1 = getchar();
    getchar();
    printf("\n动手敲代码实践了没?(输入y或Y表示有,输入n或N表示没有):");
    ans2 = getchar();
    if ((ans1 == 'y' || ans1 == 'Y') && (ans2 == 'y' || ans2 == 'Y'))
        printf("\n罗马不是一天建成的,继续保持哦:)\n");
    else
        printf("\n罗马不是一天毁灭的,我们来建设吧)\n");
    return 0;

实验结果

 

 4.实验任务4

源代码

#include<stdio.h>
int main()
{
    double x, y;
    char c1, c2, c3;
    int a1, a2, a3;
    
    scanf("%d%d%d", &a1, &a2, &a3);//没加地址表列
    printf("a1=%d,a2=%d,a3=%d\n", a1, a2, a3);

    scanf("%c%c%c", &c1, &c2, &c3);
    printf("c1=%c,c2=%c,c3=%c\n", c1, c2, c3);

    scanf("%lf%lf", &x, &y);//必须用%lf
    printf("x=%f,y=%f\n", x, y);
    
    return 0;


}

实验结果

 

5.实验任务

源代码

#include<stdio.h>
#include <math.h>
int main()
{
    int year;
    year = pow(10, 9) / (60 * 60 * 24 * 360) + 0.5;
    printf("10亿秒约等于%d年\n", year);
    return 0;
    
}

实验结果

6.实验任务6

源代码

#include <stdio.h>
#include <math.h>
int main()
{
    double x, ans;
    while (scanf("%lf", &x) != EOF)
    {
        ans = pow(x, 365);
        printf("%.2f的365次方: %.2f\n", x, ans);
        printf("\n");
    }

    return 0;
}    

实验结果

 

7.实验任务

源代码

#include <stdio.h>
#include <math.h>
int main()
{
    double C, F;
    while (scanf("%lf", &C) != EOF)
    {
        F = C * 9 / 5 + 32;
        printf("摄氏度C=%.2f时,华氏度F=%.2f", C, F);
        printf("\n");
    }
    return 0;

}

实验结果

 8.实验任务8

源代码

#include <stdio.h>
#include <math.h>
int main()
{
    int a, b, c;
    while (scanf("%d%d%d", &a, &b, &c) != EOF)
    {
        double area, s;
        s = (a + b + c)*1.0 / 2;
        area = sqrt(s * (s - a) * (s - b) * (s - c));
        printf("a=%d,b=%d,c=%d,area=%.3f", a, b, c, area);
        printf("\n");
    }
    return 0;
}

实验结果

 

标签:main,源代码,1.0,int,实验,printf,include
From: https://www.cnblogs.com/zy050101-/p/17743921.html

相关文章

  • Android跨进程数据通道若干方案的实验笔记
    一、实验背景和目标我想做一个Android平台的跨进程数据通道,通过这个通道支持若干App之间的数据传输。我想到了一些传输方案,但是缺乏在方案中做出选型的评价依据。本实验会基于若干方案实现数据传输通道,在模拟的业务场景中进行实验,从功能性指标和非功能性指标对各方案做出评价。i.......
  • 实验1 C语言输入输出和简单程序编写
    1.实验任务1 task1_1源代码:1#include<stdio.h>2#include<stdlib.h>3intmain()4{5printf("0\n");6printf("<H>\n");7printf("II\n");8printf("0\n");9prin......
  • 实验1
    1.实验1实验1_1源代码1#include<stdio.h>2intmain(){3printf("O\n");4printf("<H>\n");5printf("II\n");6return0;7} 实验1_1运行结果截图 2.实验2实验2_1源代码 1#include<stdio.h>2intmain(......
  • C++ namespace User_Unauthorized version 1.0.0 is officially released
    CodenamespaceUser_Unauthorized{/***@briefThisisaheaderfileforcompetitiveprogramming.*@authorUser-Unauthorized*@version1.0.0*@date2023-10-5*/typedeflonglongvalueType;typedefstd::vector<......
  • 21 HCIA-综合实验
    拓扑规划说明如图1实现一个典型的企业网,其中总部(包含R1、SW1、SW2和SW3)为企业主园区网络,分支为企业分支网络,云部分代表互联网设备(8.8.8.8)。读者需要完成总部和分支基本的网络功能,可以访问互联网(8.8.8.8)以及通过GREVPN使得位于两个AS的终端实现跨越广域网的通信整......
  • 实验1_c语言输入输出和简单程序应用编程
    实验一1-1#include<stdio.h>intmain(){printf("O\n");printf("<H>\n");printf("II\n");printf("O\n");printf("<H>\n");printf("II\n");......
  • 实验1
    实验1源代码1//打印一个字符小人23#include<stdio.h>4intmain()5{6printf("o\n");7printf("<H>\n");8printf("II\n");9printf("o\n");10printf("<H>\n&q......
  • 实验1 C语言输入输出和简单程序编写
    1.试验任务1  task1.c//打印一个字符小人#include<stdio.h>intmain(){printf("o\n");printf("<H>\n");printf("II\n");return0;} task1_1.c//在垂直方向上打印出两个小人#include<stdio.h>int......
  • 视频监控/监控汇聚平台EasyCVR协力打造智慧实验室
    实验室安全管理系统利用智能传感器和视频监控设备,结合物联网技术、视觉分析技术和大数据技术,构建了数字化的安全防控体系。该系统可以全面感知实验室的环境安全,实时监测和分析人员身份、操作规程以及安全措施的情况,快速上报安全事件并实现应急处置的闭环管理。通过科技手段,实验室......
  • 实验1 线性拟合 冷却
    '''目标:拟合物料冷却规律分类变量:物料规格,冷却方式连续变量:温度,时间其他因素:车间温度现实因素:初始温度,初始时间需求因素:目标温度的时间,目标温度的时长(时间-初始时间),当前时间的温度不加入分类变量则为单个线性模型''''''实验1只有温度和时间每个物料的初始温......