我正在尝试完成家庭作业,但我在任何地方都找不到。我正在尝试将输入数字与随机生成的数字相匹配,并显示 5 个数字中有多少是正确的(也带有赢/输消息)。这是我到目前为止所拥有的,任何帮助将不胜感激。
#include <iostream>
#include <cstdlib>
using namespace std;
void main()
{
//variables
int lottery[5], user[5];
int count = 0;
int num1, num2, num3, num4, num5;
int winnum;
//generating numbers
for (int i=0; i <5; i++)
{
lottery[i] =1+rand()%9;
}
//input
cout << "Enter a digit between 0-9: ";
cin >> num1;
// ...
cin >> num5;
winnum = rand();
//display
cout << "Winning Lottery Numbers: " << winnum << endl;
cout << "Your ticket Numbers: "
<< num1 << num2 << num3 << num4 << num5 << endl;
//matching the numbers
//HELP!
system("pause");
}