随机数C/C++

#include <iostream>
#include <stdlib.h>
#include <time.h>

using namespace std;
int main(){
	srand(time(NULL));
	int number=rand()%50+51;
	
    if(number<60){
    	cout << "bad" <<endl;
	}else if(60<=number<80){
		cout << "soso" <<endl;	
	}else{
		cout << "good" <<endl;
	}	
 		cout << "number is " << number <<endl;
	return 0;	
}
 

猜你喜欢

转载自blog.csdn.net/qq_62480054/article/details/131585983