64,574
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int counter;
for(counter=0;counter <10;counter++)
{
srand(counter+1);
cout <<"Random number" <<counter+1 <<":" <<rand() <<endl;
}
return 0;
}
#include <iostream>
#include"cstdlib"
int main()
{
unsigned int counter;
for(counter=0;counter <10;counter++)
{
srand(counter+1);
std::cout <<"Random number" <<counter+1 <<":" <<std::rand() <<std::endl;
}
return 0;
}