首页 > 其他分享 >实验1

实验1

时间:2024-03-16 23:45:29浏览次数:27  
标签:include return int pause 实验 printf main

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     printf(" o\n");
 6     printf("<H>\n");
 7     printf("I I\n");
 8     printf(" o\n");
 9     printf("<H>\n");
10     printf("I I\n");
11     system("pause");
12     return 0;
13 }

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     printf(" o      o\n");
 6     printf("<H>    <H>\n");
 7     printf("I I    I I\n");
 8     system("pause");
 9     return 0;
10 }

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     float a,b,c;
 6     scanf("%f%f%f",&a,&b,&c);
 7     if(a+b>c&&a+c>b&&b+c>a)
 8         printf("能构成三角形\n");
 9     else
10         printf("不能构成三角形\n");
11     system("pause");
12     return 0;
13 }

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     char ans1,ans2;
 6     printf("每次课前认真预习,课后及时复习了没(输入y或Y表示有,输入n或N表示没有):");
 7     ans1=getchar();
 8     printf("\n动手敲代码实践了没?(输入y或Y表示敲了,输入n或N表示没有敲):");
 9     ans2=getchar();
10     if((ans1=='y'||ans1=='Y')&&(ans2=='y'||ans2=='Y'))
11         printf("\n罗马不是一天建成的,继续保持哦:)\n");
12     else
13     printf("\n罗马不是一天毁灭的,我们来建设吧:)\n");
14 
15     system("pause");
16     return 0;
17 }

因为getchar()收取了回车键

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     double x, y;
 6     char c1,c2,c3;
 7     int a1,a2,a3;
 8     scanf("%d%d%d",&a1,&a2,&a3);//缺少取地址字符,已添加
 9     printf("a1=%d,a2=%d,a3=%d\n",a1,a2,a3);
10 
11     scanf("%c%c%c",&c1,&c2,&c3);
12     printf("c1=%c,c2=%c,c3=%c\n",c1,c2,c3);
13 
14     scanf("%lf,%lf",&x,&y);//已修改,输出格式字符错误
15     printf("x=%lf,y=%lf",x,y);
16 
17     system("pause");
18     return 0;
19 }

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     int year;
 6         year=1000000000/(365*24*60*60);
 7         if((1000000000-year)<(0.5*365*24*60*60))
 8         printf("year=%d", year);
 9         else
10         year=year+1;
11         printf("year=%d",year);
12         system("pause");
13     return 0;
14 }

 1 #include<stdio.h>
 2 #include<math.h>
 3 #include<stdlib.h>
 4 int main()
 5 {
 6     double x ,ans;
 7      while(scanf("%lf",&x)!=EOF)
 8      {
 9          ans=pow(x,365);
10          printf("%.2f的365次方; %.2f\n",x,ans);
11          printf("\n");
12      }
13         system("pause");
14     return 0;
15 }

 1 #include<stdio.h>
 2 #include<stdlib.h>
 3 int main()
 4 {
 5     double C,F;
 6     while(scanf("%lf",&C)!=EOF)
 7     {
 8     F=9*C/5+32;
 9     printf("摄氏度C=%.2f时,华氏度F=%.2f\n",C,F);
10     }
11     system("pause");
12     return 0;
13 }

 1 #include<stdio.h>
 2 #include<math.h>
 3 #include<stdlib.h>
 4  int main()
 5 {
 6     double a,b,c,s,area;
 7     while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
 8     {
 9 
10     s=(a+b+c)/2;
11     area=sqrt((s-a)*(s-b)*(s-c)*s);
12 
13     printf("area=%.3f\n",area);
14     }
15 
16     system("pause");
17     return 0;
18 }

 

标签:include,return,int,pause,实验,printf,main
From: https://www.cnblogs.com/940804telck/p/18077892

相关文章

  • 实验报告1-熟悉C语言运行环境
    实验报告1实验名称:实验一熟悉C语言运行环境实验类型:验证性实验日期:2023年3月14日一、实验目的下载安装Dev-c6.0程序。了解在该系统上如何进行编辑、编译、连接和运行一个C程序。通过运行简单的C程序了解C程序的特点。二、实验硬、软件环境Windows计算机、Dev-c6.0三......
  • 实验报告一(输出简单图形&输出最大值)
    C语言程序设计——实验报告一实验项目名称:实验一熟悉C语言运行环境实验项目类型:验证性实验日期:2023年3月14日一·实验目的下载安装devc6.0程序。了解在该系统上如何进行编辑,编译,连接,和运行一个c程序。通过运行简单的c程序了解c程序的特点。二·实验硬,软件环境windows......
  • 实验1
    `#include<stdio.h>include<stdlib.h>intmain(){printf("O\n");printf("\n");printf("II\n");system("pause");return0;}``#include<stdio.h>include<stdlib.h>intmain(){printf......
  • 实验1
    #include<stdio.h>intmain(){ printf("o\n"); printf("<H>\n"); printf("II\n"); printf("o\n"); printf("<H>\n"); printf("II\n"); return0;}#inc......
  • 【二】【单片机】有关独立按键的实验
    自定义延时函数Delay分别用Delay.c文件存储Delay函数。用Delay.h声明Delay函数。每次将这两个文件复制到工程中,直接使用。//Delay.cvoidDelay(unsignedintxms)//@11.0592MHz{while(xms--){unsignedchari,j;......
  • 实验1 C语言开发环境使用和数据类型,运算符,表达式
    #include<stdio.h>intmain(){printf("O\n");printf("<H>\n");printf("II\n");return0;}#include<stdio.h>intmain(){printf("O\n");printf("<H>\n");print......
  • 瑞熙贝通实验室物联网管理平台新升级|支持远程开门视频监控与电源控制以及环境监测
    瑞熙贝通实验室智能物联网管控平台:利用“互联网+与物联网技术”有机融合,对实验室的用电安全监测、实验室环境异常监测(颗粒物监测、明火监测、可燃气体、烟雾监测、温湿度传感器、红外人体感应)、实验室人员安全准入、万物互联等进行有效感知识别,运用人脸识别、门禁系统、传感器......
  • c语言实验一
    #include<stdio.h>#include<stdlib.h>intmain(){printf("o\to\n");printf("<H>\t<H>\n");printf("II\tII\n");system("pause");return0;}#include&......
  • 基于Java+SpringBoot的开放实验室管理系统子系统毕业设计(源码+论文)
    作者主页:Java程序员老张主要内容:SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app等设计与开发。收藏点赞不迷路 关注作者有好处文末获取源码技术选型【后端】:Java【框架】:SpringBoot【前端】:vue【JDK版本】:JDK1.8【服......
  • c语言程序设计——实验报告一
    c语言程序设计——实验报告一实验项目名称:实验一熟悉C语言运行环境实验项目类型:验证性实验日期:2023年3月14日一、实验目的下载安装Devc6.0程序。了解在该系统上如何进行编辑、编译、连接和运行一个C程序。通过运行简单的C程序了解C程序的特点。二、实验硬、软件环境W......