![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言函数
在日常学习中,我们会遇到很多我们从未见过的函数,该专栏用于记录这类函数
箱根山岳险天下42.195
这个作者很懒,什么都没留下…
展开
-
scanf()函数
C语言的输入函数。scanf输入几个数,就会返回输入个数。例如:int n1 = 0;int n2 = 0;scanf("%d %d",&n1,&n2);以上代码,scanf输入两个数,那么就会返回2。在一些需要循环输入案例中,就可以用到该特性。#include<stdio.h>int main(){ int n1 = 0; int n2 = 0; while(scanf("%d %d",&n1,&am原创 2022-02-08 09:15:49 · 323 阅读 · 0 评论 -
如何产生随机数?
#include <stdio.h>#include <stdlib.h>#include <time.h>int main() { int a; srand((unsigned)time(NULL)); a = rand(); printf("%d\n", a); return 0;}要想取一定范围的随机数,用%。以下就是取0-99随机数。 a = rand() % 100;...原创 2022-02-07 20:31:45 · 265 阅读 · 0 评论