产生随机数
本文最后更新于 1830 天前,其中的信息可能已经有所发展或是发生改变。
#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<iomanip>
using namespace std; 
int main() { 
	srand((int)time(0));  
	int a,b,c,d,e,b1,c1,d1;
	a=(rand()%20);
	if(a==0)   a++;
	b1=50-a-3;
	b=(rand()%b1);
	if(b==0)   b++;
	c1=50-a-b-2;
	c=(rand()%c1);
	if(c==0)   c++;
	d1=50-a-b-c-1;
	d=(rand()%d1);
	if(d==0)   d++;
	e=50-a-b-c-d;
	
    
	cout<<"50只动物随机分为五个组"<<endl;
	cout<<"A组"<<"  B组"<<"  C组"<<"  D组"<<"  E组"<<endl;
	cout<<setw(2)<<a<<"   "<<setw(2)<<b<<"   "<<setw(2)<<c<<"   "<<setw(2)<<d<<"   "<<setw(2)<<e<<endl;
 	system("pause");
    
    return 0;
}
作者:Yuyy
博客:https://yuyy.info
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇