鱼C论坛

 找回密码
 立即注册
查看: 1622|回复: 16

[已解决]来猜猜这个程序怎么做

[复制链接]
发表于 2023-6-23 21:22:05 | 显示全部楼层 |阅读模式
30鱼币
本帖最后由 陈尚涵 于 2023-6-23 21:53 编辑

今天我正在瞎玩c++,然后呢就神奇的运行了起来
这个程序实际实现非常简单(规范代码下,20行以下),大家猜猜怎么做,这边悬赏给的也是很大方好吧
规则很简单,这边免费提供附件exe程序,这个程序没有结束,自行点×退出
大家看程序后自行下载然后写出你的代码,只要和实际代码思路一样即可
[Xiao Hei Zi Warning]
小黑子.zip (450.13 KB, 下载次数: 4)
@sfqxx @zhangjinxuan @元豪 @歌者文明清理员 @一点沙 @lzb1001
最佳答案
2023-6-23 21:22:06
本帖最后由 Ewan-Ahiouy 于 2023-6-24 08:53 编辑



  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(){
  4.         string s[] = {"鸡你太美", "荔枝", "你干嘛~嗨嗨哎哟~", "近一点快被融化", "多一眼就会爆炸"};
  5.         srand(time(NULL));
  6.         while (true){
  7.                 int a = rand() % 200 + 100;
  8.                 int xia = rand() % 5 + 0;
  9.                 cout << s[xia];
  10.                 for (int i = 0; i < a; i++){
  11.                         cout << ' ';
  12.                 }
  13.         }
  14.        
  15.         return 0;
  16. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:22:06 | 显示全部楼层    本楼为最佳答案   
本帖最后由 Ewan-Ahiouy 于 2023-6-24 08:53 编辑



  1. #include <bits/stdc++.h>
  2. using namespace std;

  3. int main(){
  4.         string s[] = {"鸡你太美", "荔枝", "你干嘛~嗨嗨哎哟~", "近一点快被融化", "多一眼就会爆炸"};
  5.         srand(time(NULL));
  6.         while (true){
  7.                 int a = rand() % 200 + 100;
  8.                 int xia = rand() % 5 + 0;
  9.                 cout << s[xia];
  10.                 for (int i = 0; i < a; i++){
  11.                         cout << ' ';
  12.                 }
  13.         }
  14.        
  15.         return 0;
  16. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:24:49 | 显示全部楼层
emm,不会
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-6-23 21:25:40 | 显示全部楼层

实际代码量不到20行
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:25:55 | 显示全部楼层
陈尚涵 发表于 2023-6-23 21:25
实际代码量不到20行

手机党 qwq
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:29:36 | 显示全部楼层
小黑子露出鸡脚了吧
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:35:17 | 显示全部楼层
“技术交流”

评分

参与人数 1荣誉 -5 贡献 -3 收起 理由
sfqxx -5 -3 你被扣分更精彩^_^

查看全部评分

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-6-23 21:35:41 | 显示全部楼层

就是技术交流啊,怎么了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:36:45 | 显示全部楼层
陈尚涵 发表于 2023-6-23 21:35
就是技术交流啊,怎么了

那最佳的话就不会记入互助平台了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 21:46:17 | 显示全部楼层
有人吗?
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-6-23 21:50:17 | 显示全部楼层

厉害,恭喜获得30育碧
源代码:
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. #include <string>
  5. using namespace std;
  6. int main(){
  7.         string a[] = {"鸡你太美","你干嘛哈哈哎呦","近一点快被融化","多一眼就会爆炸","荔枝"};
  8.         int alen = 5;
  9.         srand(time(0));
  10.         for(int i=0;;i++){
  11.                 cout << a[rand()%alen];
  12.                 for(int j=0;j<=rand()%1032+114;j++){
  13.                         cout<<" ";
  14.                 }
  15.         }
  16.         return 0;
  17. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-23 22:30:54 | 显示全部楼层

                               
登录/注册后可看大图

  1. namespace TestRandCSharp
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             string[] s = {"鸡你太美", "荔枝", "你干嘛~嗨嗨哎哟~", "近一点快被融化", "多一眼就会爆炸"};
  8.             Random random = new Random();

  9.             while (true)
  10.             {
  11.                 int xia = random.Next(0, 5);
  12.                 int a = random.Next(100, 300);

  13.                 Console.Write(s[xia]);

  14.                 for (int i = 0; i < a; i++)
  15.                 {
  16.                     Console.Write(' ');
  17.                 }

  18.                 //延迟一段时间,降低输出速度
  19.                 Thread.Sleep(1000);
  20.             }
  21.         }
  22.     }
  23. }
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2023-6-23 22:35:27 | 显示全部楼层

写的没错,但是来晚了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-24 00:01:30 | 显示全部楼层
本帖最后由 wuliangtdi 于 2023-6-24 00:03 编辑
陈尚涵 发表于 2023-6-23 22:35
写的没错,但是来晚了

稍微修改了一下:
csharp:
  1. namespace TestRandCSharp
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             string[] s = {"鸡你太美", "荔枝", "你干嘛~嗨嗨哎哟~", "近一点快被融化", "多一眼就会爆炸"};
  8.             Random random = new Random();
  9.             String? total = null;
  10.             while (true)
  11.             {

  12.                 int xia = random.Next(0, 5);
  13.                 int a = random.Next(100, 300);
  14.                 total = new String(' ',a);
  15.                 Console.Write(s[xia]);
  16.                 Console.Write(total);
  17.                 total = null;
  18.                 //延迟一段时间,降低输出速度
  19.                 Thread.Sleep(1000);
  20.             }
  21.         }
  22.     }
  23. }
复制代码


CPP:
  1. #include <iostream>
  2. #include <string>
  3. #include <ctime>
  4. #include <cstdlib>

  5. using namespace std;

  6. int main()
  7. {
  8.         string s[] = {"鸡你太美", "荔枝", "你干嘛~嗨嗨哎哟~", "近一点快被融化", "多一眼就会爆炸"};
  9.         srand(static_cast<unsigned>(time(NULL)));

  10.         while (true)
  11.         {
  12.                 int xia = rand() % 5 + 0;
  13.                 int a = rand() % 200 + 100;

  14.                 cout << s[xia];

  15.                 string spaces(a, ' ');
  16.                 cout << spaces;
  17.         }

  18.         return 0;
  19. }
复制代码

小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-24 00:02:36 | 显示全部楼层
陈尚涵 发表于 2023-6-23 22:35
写的没错,但是来晚了

无所谓,鱼币啥的都有四千多。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-24 08:57:56 | 显示全部楼层
感谢
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2023-6-24 16:36:17 | 显示全部楼层
来晚了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-10 02:18

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表