• 数组——抽奖&&句子组合


     1 namespace ChouJiang
     2 {
     3     class Program
     4     {
     5         static void Main(string[] args)
     6         {
     7 
     8             string[] a = new string  [] { "张三", "李四", "王五", "赵六", "田七", "朱八" };
     9             string []b=new string []{"彩电", "笔记本电脑", "iPhone6", "iPad Mini 2"};
    10             
    11             Random rand=new Random ();
    12 
    13             for (int i = 0; i < 50; i++)
    14             {
    15                 int n = rand.Next(a.Length); //生成随机下标
    16                 Console.WriteLine(a[n]);
    17                 System.Threading.Thread.Sleep(50); //停50毫秒
    18                 Console.Clear();//清屏
    19             }
    20 
    21             int m=rand .Next (a.Length );
    22             int k=rand.Next (b.Length );
    23 
    24             Console.WriteLine("恭喜"+a[m]+"中了"+b[k]+"");
    25 
    26             Console.ReadLine();
    27 
    28                     }
    29     }
    30 }
    抽奖
     1 namespace ChouJiang
     2 {
     3     class Program
     4     {
     5         static void Main(string[] args)
     6         {
     7 
     8           
     9             string[] a = new string[] { "张三", "李四", "王五", "赵六", "田七", "朱八" };
    10             string[] b = new string[] { "天台上", "垃圾桶边", "树下", "海边", "电影院", "大街上" };
    11             string[] c = new string[] { "吃饭", "睡觉", "玩手机", "喝汽水", "打豆豆", "摄影", "修照片", "找吃的" };
    12             string[] d = new string[] { "优雅地", "装B地", "傻了吧唧地", "高高兴兴地", "认真地", "郁闷地", "一声不吭地", "忘我地" };
    13             Random rand = new Random();
    14 
    15             int i = rand.Next(a.Length);
    16             int j = rand.Next(b.Length);
    17             int k = rand.Next(c.Length);
    18             int m = rand.Next(d.Length);
    19             Console.WriteLine(a[i] + "" + b[j] + d[m] + c[k] + "");
    20 
    21 
    22         }
    23     }
    24 }
    句子组合
  • 相关阅读:
    北邮ivi测试频道 26个高清频道 IPv4 有PC端和移动端地址
    Nginx+ffmpeg+ckplayer海康监控摄像头在web页面播放RTSP转RTMP
    Vlc播放RTSP
    [RTSP]WPF用VLC显示RTSP视频
    WPF 使用 VLC 3.0.10 的基本操作
    【矩阵专题】——矩阵快速幂
    1120:同行列对角线的格
    1120:同行列对角线的格
    1120:同行列对角线的格
    1119:矩阵交换行
  • 原文地址:https://www.cnblogs.com/Kekeluotu/p/4487168.html
Copyright © 2020-2023  润新知