首页 > 其他分享 >实验二

实验二

时间:2022-10-22 16:25:04浏览次数:35  
标签:int lucky else 实验 printf include day

#include<stdio.h>
#include <math.h> #include <time.h>

#define N 5
int main()
{
    int number;
    int i;
    srand(time(0));
    for(i=0;i<N;++i)
    {
        number =rand()%500+1;
        printf("20228329%04d\n",number);
    }
    system("pause");
    return 0;
}


#include <stdlib.h> #include<stdio.h> #include <math.h> #include <time.h> int main() { int n,i,c; printf("猜猜2022年11月哪一天会是你的lucky day\n"); scanf_s("%d",&n); printf("开始喽,你有三次机会,猜吧(1~30):%d\n",n); srand( time(0) ); c=rand()%30+1; if(n==c) { printf("哇,猜中了\n"); return 0; }else if(n>c){ printf("你猜的日期晚了,你的lucky day已经过啦\n"); }else{ printf("你猜的日期早了,你的lucky day还没到呢\n"); } for(i=1;i<=2;i++) { scanf_s("%d",&n); if(n==c) { printf("哇,猜中了"); return 0; }else if(n>c){ printf("你猜的日期晚了,你的lucky day已经过啦\n"); }else{ printf("你猜的日期早了,你的lucky day还没到呢\n"); } } printf("次数用完了。偷偷告诉你:11月,你的lucky day是%d号",c); system("pause"); return 0; }

#include <math.h>
#include <stdlib.h>
#include<stdio.h>
#include <time.h>
int main()
{
    char a;
    while(scanf_s("%c", &a) != EOF)
    {
        if(a=='r')
        {    
            printf("stop!\n");
        }else if(a=='g'){
            printf("go go go \n");
        }else if (a=='y'){
            printf("wait a minute\n");
        }else{
            printf("something must be wrong...\n");
        }
        getchar();
    }
    system("pause");
    return 0;
}

#include <math.h>
#include <stdlib.h>
#include<stdio.h>
int main()
{
    
        int n,a,up;
        while(scanf_s

("%d %d",&n,&a)!=EOF)
        {
            double down=1,sum=0,c;
        for(up=1;up<=n;up++)
        {
            down=down*a;
            c=up/down;
            sum+=c;
        }
        
        printf("%f\n",sum);
        getchar();
        }
    system("pause");
    return 0;
}

 

#include<stdio.h>
int main()
{

    int i, n, c;
    for (i = 1; i <= 9; i++)
    {
        for (n = 1; n <= i; n++)
        {
            c = n * i;
            printf("%d*%d = %d ", i, n, c);
        }
        printf("\n");
    }
    system("pause");
    return 0;
}

#include <math.h>
#include <stdlib.h>
#include<stdio.h>
int main()
{
    int i,n,o,d;
    scanf_s("%d",&i);
    printf("%d\n",i);
    for(n=1;n<=i;n++){
        for(d=1;d<n;d++)
        {
            printf("   ");
        }
        for(o=1;o<=2*i+1-2*n;o++)
        {
            printf(" o ");
        }
        printf("\n");
        for(d=1;d<n;d++)
        {
            printf("   ");
        }
        for(o=1;o<=2*i+1-2*n;o++)
        {
            printf("<H>");
            
        }
        printf("\n");
        for(d=1;d<n;d++)
        {
            printf("   ");
        }
        for(o=1;o<=2*i+1-2*n;o++)
        {
            printf("I I");
            
        }
        printf("\n");
    }
    
    system("pause");
    return 0;
}

 

标签:int,lucky,else,实验,printf,include,day
From: https://www.cnblogs.com/wgc20030213/p/16816328.html

相关文章

  • 实验三
    实验五info.hpp#pragmaonce#include<iostream>#include<string>usingnamespacestd;classinfo{public:info(stringni0,stringco0,stringci0,intn......
  • 实验一:决策树算法实验
    实验一:决策树算法实验|博客班级|https://edu.cnblogs.com/campus/czu/classof2020BigDataClass3-MachineLearning||----|----|----||作业要求|https://edu.cnblogs.com/......
  • 实验5:开源控制器实践——POX
    实验5:开源控制器实践——POX一、实验目的能够理解POX控制器的工作原理;通过验证POX的forwarding.hub和forwarding.l2_learning模块,初步掌握POX控制器的使用方法;能够运......
  • 实验5:开源控制器实践——POX
    一、基础实验(1)tcpdump验证Hub模块h1-->h2和h1-->h3(2)tcpdump验证Switch模块h1-->h2和h1-->h3(3)L2_learning模块代码流程图二、进阶实验(1)进阶一(2)进阶二......
  • 《MiniPRO H750开发指南》第六十四章 综合测试实验
    第六十四章综合测试实验​为了方便大家使用和验证综合例程,本章内容是综合例程的使用介绍。目的是展示STM32H7的强大处理能力,并且可以测试开发板的大部分功能。本实验代码只......
  • 实验5:开源控制器实践——POX
    (一)基本要求(1)阅读Hub模块代码,使用tcpdump验证Hub模块;(2)阅读L2_learning模块代码,画出程序流程图,使用tcpdump验证Switch模块。流程图(二)进阶要求(1)重新搭建(一)的拓扑,此......
  • 实验5:开源控制器实践——POX
    一、实验目的能够理解POX控制器的工作原理;通过验证POX的forwarding.hub和forwarding.l2_learning模块,初步掌握POX控制器的使用方法;能够运用POX控制器编写自定义网络......
  • 小孩的游戏 - 2021数据结构 排序和选择实验题
    小孩的游戏-2021数据结构排序和选择实验题pre做都做了,干脆发上来算了:D题目分析算法与数据结构实验题5.18小孩的游戏★实验任务一群小孩子在玩游戏,游戏......
  • 【计组实验】实验f1 mux21a
    一、实验目标测试mux21a二选一多路选择器的功能,并做出仿真波形。二、实验原理用VHDL代码实现mux21a二选一多路选择器的功能,用QuartusⅡ编译代码并展示元件图,最后制造波......
  • 【计组实验】实验f3 正弦信号发生器
    一、实验目标使用正弦波信号发生器,生成仿真波形。二、实验原理用VHDL代码完成正弦信号发生器以及data_rom的功能,生成一组正弦信号数据rom.mif。进行波形仿真,给正弦信号......