#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
class Random { //Random이라는 클래스 생성
public:
int r = 11;
int next;
int nextinrange; //멤버함수 3개 정의
};
int main()
{
srand((unsigned)time(0));
int n = rand(); //랜덤숫자 생성
Random r;
cout << "-- 0에서 " << RAND_MAX << "까지의 랜덤 정수 10 개--" << endl;
for (int i = 0; i < 10; i++) {
int n = r.next;
cout << n << ' '; //0~RAND_MAX까지의 랜덤정수 출력
}
cout << endl << endl << "-- 2에서 " << "4 까지의 랜덤 정수 10 개 --" << endl;
for (int i = 0; i < 10; i++) {
int n = r.nextinrange;
cout << n << ' '; //2에서 4 사이의 랜덤정수 출력
}
}
이 코드를 짜서 어째저째 빌드 성공은 했으나 제 비주얼 스튜디오가 프리뷰 버전이라 오류때문인지 결과 확인을 할 새도 없이 도스창이 꺼져 버리네요 ㅠㅡㅠ
누가 빌드결과만 알려주세요 ㅠㅠ