为什么我的for循环没起作用,只执行了一次?(用c语言正常执行)
#include<iostream>#include<cstdlib>#include<ctime>usingnamespacestd;intmain(){intb,i,...
#include <iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
intb,i,r;
srand((unsigned int)time(NULL));
b=1+rand()%16;
for(i=1;i<=6;i++)
r=1+rand()%33;
cout<<"red is:"<<r<<"\n"<<"blue is:"<<b<<endl;
} 展开
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
intb,i,r;
srand((unsigned int)time(NULL));
b=1+rand()%16;
for(i=1;i<=6;i++)
r=1+rand()%33;
cout<<"red is:"<<r<<"\n"<<"blue is:"<<b<<endl;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询