나는 insta가 로또 번호를 고르는 앱을 가지고 있습니다. 배열을 추가하려고 시도했지만 Bubble 메서드를 시도했지만 코드에 통합 할 위치를 모른다. 여러 번 시도하고 여러 가지 방법을 시도했지만 오류가 계속 발생합니다. 어떤 충고?랜덤 넘버 생성기는 C++에서 가장 낮은 것부터 가장 높은 것까지 어떻게 올 수 있습니까?
/*This app will give you your lotto max numbers!*/
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main()
{
int lotto[7];
//allows users to input a seed, that way the tickets wont be
//generated the same if they want two.
unsigned seed;
cout << "Enter seed ";
cin >> seed;
srand(seed) ;
//greeting
cout << "*** LOTTO MAX INSTA PICK ***" << endl;
cout << " " << endl << endl;
cout << "Your Insta Pick Numbers" << endl;
cout<< " " << endl << endl;
//initilizes the counter and making sure the amount of numbers does not exceed 21
for (int counter = 1; counter <= 7;++ counter)
{
//outputs numbers between 1 and 27 with 7 numbers in each row
cout << setw(1) << (1 + rand() % 49) << " " ;
//stops the counter for each row
if (counter % 7 == 0)
cout << endl;
}
//space in between the numbers and tag numbers
cout<< " " << endl << endl;
cout << "Your Tag Numbers" << endl;
cout << " " << endl << endl;
//initilizes counter and makes sure numbers dont go over 6
for (int counter = 1; counter <= 6; ++ counter)
{
//sets the numbers between 0 and 9 and outputs them
cout << setw(0) << (0 + rand() % 9)<< " " ;
//stops the counter
if (counter % 9 == 0)
cout << endl;
}
cout << " " << endl << endl;
//end message
cout << "Thank you for playing!! please check ticket\n a year minus a day from date of purchase" <<endl;
};
오류 메시지가 무엇인가요? – CoffeeRain
무엇이 오류입니까? –
들여 쓰기를 먼저 수정하십시오. –