我被困在如何使用 rand() 函数并包含该随机数的范围。我需要一个介于 67.00 和 99.99 之间的随机数才能打印。
这是我尝试过的,但失败了......
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x = rand();
if(x>=67.00)
if(x<=99.99)
printf("%d\n",x);
else
printf("not in range");
}