用C语言如何实现从数组中随机取出任意7个数(7个数不相等)

用C语言如何实现从数组中随机取出任意7个数(7个数不相等)
数组为a[N]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32.33,34,35}
zbq8341 1年前 已收到3个回答 举报

avmp3 幼苗

共回答了20个问题采纳率:80% 举报

#include
#include
#include
#define N 35
void main()
{
int a[N]={1,2,3,4,5,6,
7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,
32.33,34,35};
int flag[N]={0},b[7];
srand(time(NULL));
for(int i=0;i

1年前

3

幽香 幼苗

共回答了26个问题采纳率:76.9% 举报

#include
#include
#include
void main()
{int a[36],g,flag=0,n=0,leap=0;
for(int i=1;i

1年前

2

zbhualu 幼苗

共回答了20个问题采纳率:70% 举报

看看符合要求不?
#include
#include
int main()
{
int a,i,j,m;
int a[35]={1,2,3,…………33,34,35};//自己补全。
srand(time(0));
for(i=0;i

1年前

1
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 18 q. 1.722 s. - webmaster@yulucn.com