当前位置:网站首页>Call the random function to generate 20 different integers and put them in the index group of institute a
Call the random function to generate 20 different integers and put them in the index group of institute a
2022-06-26 16:44:00 【Muzi..】
#include<stdio.h>
#include<stdlib.h>
#define N 20
void fun(int *a);
int main()
{
int x[N],i;
fun(x);
printf("the result:\n");
for(i=0;i<N;i++)
{
printf("%4d",x[i]);
if((i+1)%5==0)
printf("\n");
}
}
void fun(int *a)
{
int x,i,n=0;
x=rand()%20;
while(n<20)
{
for(i=0;i<n;i++)
if(x==a[i])
{
break;
}
if(i==n)
{
a[n]=x;n++;
}
x=rand()%20;
}
}
边栏推荐
- Keepalived 实现 Redis AutoFailover (RedisHA)
- How to implement interface current limiting?
- No manual prior is required! HKU & Tongji & lunarai & Kuangshi proposed self supervised visual representation learning based on semantic grouping, which significantly improved the tasks of target dete
- LeetCode Algorithm 24. Exchange the nodes in the linked list in pairs
- # 补齐短板-开源IM项目OpenIM关于初始化/登录/好友接口文档介绍
- 请指教同花顺软件究竟是什么?网上开户是否安全么?
- "C language" question set of ⑩
- Memory partition model
- Notes on key review of software engineering at the end of the term
- QT 5.9.8 installation tutorial
猜你喜欢
[Li Kou brush questions] 11 Container holding the most water //42 Rain water connection
Scala 基础 (二):变量和数据类型
TCP拥塞控制详解 | 1. 概述
Constructors and Destructors
Niuke Xiaobai monthly race 50
建立自己的网站(16)
无需人工先验!港大&同济&LunarAI&旷视提出基于语义分组的自监督视觉表征学习,显著提升目标检测、实例分割和语义分割任务!...
Arduino uno + DS1302 simple time acquisition and serial port printing
Qt 5.9.8 安装教程
精致妆容成露营“软实力”,唯品会户外美妆护肤产品销量激增
随机推荐
Fgetc() reads content from file
proxy
Acid of redis
最小二乘系统辨识课 中篇:递归最小二乘
mha 切换(操作流程建议)
How can I get the stock account opening discount link? Is online account opening safe?
Natural language inference with attention and fine tuning Bert pytorch
What does the inner structure of the neural network "alchemy furnace" look like? An interpretation of the thesis by the doctor of Oxford University
C语言 头哥习题答案截图
What is flush software? Is it safe to open an account online?
[force deduction question] two point search: 4 Find the median of two positive arrays
【从删库到跑路】MySQL基础 完结篇(入个门先跑路了。。)
Develop operator based on kubebuilder (for getting started)
数据分析----numpy快速入门
Science | giant bacteria found in mangroves challenge the traditional concept of nuclear free membrane
Stm32h7b0 replaces the h750 program, causing the MCU to hang up and unable to burn the program
建立自己的网站(16)
Greenplum database fault analysis - semop (id=2000421076, num=11) failed: invalid argument
Scala Foundation (2): variables et types de données
【毕业季】致毕业生的一句话:天高任鸟飞,海阔凭鱼跃