C++ C++;乐透号码发生器
我正在开发一个程序,该程序必须在0-9之间创建一个由5个随机数组成的数组,然后我必须要求用户输入5个0-9之间的数字,并将其存储在and数组中,然后比较它们并显示它们是否都正确。我把它都写出来了,但它总是给我这个错误C++ C++;乐透号码发生器,c++,visual-studio-2012,C++,Visual Studio 2012,我正在开发一个程序,该程序必须在0-9之间创建一个由5个随机数组成的数组,然后我必须要求用户输入5个0-9之间的数字,并将其存储在and数组中,然后比较它们并显示它们是否都正确。我把它都写出来了,但它总是给我这个错误 Error 1 error C1075: end of file found before the left brace '{' at 'c:\users\bigt\documents\visual studio 2012\projects\consoleapplicat
Error 1 error C1075: end of file found before the left brace '{' at
'c:\users\bigt\documents\visual studio 2012\projects\consoleapplication2\
consoleapplication2\source.cpp(9)'
was matched c:\users\bigt\documents\visual studio 2012\projects\
consoleapplication2\consoleapplication2\source.cpp 65 1
ConsoleApplication2
这让我觉得我有一个逻辑错误,有人能帮我找到哪里做错了吗
//#include "stdafx.h"
#include <iostream>
#include <cstdlib>
using namespace std;
//void showValues(int[], int);
int main()
{
const int array_size = 5;
int numbers[array_size];
int win_num[array_size];
int count = 0;
cout << "enter your altto drawing" <<endl;
for(int i = 0; i < array_size; i++)
{
cin >> numbers[i];
}
for (int i = 0 ; i < array_size; i++)
{
win_num[i] = rand()%10;
}
for (int i =0; i < array_size; i++)
{
if (numbers[i] != win_num[i])
{
cout << "sorry try again" << endl;
}
else
{
count++;
}
if (count == 5)
{
cout << " you win" << endl;
}
else
{
cout << " you did not win, you had" << count << "right numbers" << endl;
}
cout << "the winning numbers are" << endl;
for( int i = 0; i < array_size ; i ++)
{
cout << win_num[i] << " ";
}
system ("pause");
return 0;
}
/#包括“stdafx.h”
#包括
#包括
使用名称空间std;
//无效显示值(int[],int);
int main()
{
常量int数组_size=5;
整数[数组大小];
int win_num[数组大小];
整数计数=0;
您是否错过了一次结账
}这里:
for (int i =0; i < array_size; i++)
{
if (numbers[i] != win_num[i])
{
cout << "sorry try again" << endl;
}
else
{
count++;
}
}//^^this one is missing
for(int i=0;i 您是否错过了一次结账
}这里:
for (int i =0; i < array_size; i++)
{
if (numbers[i] != win_num[i])
{
cout << "sorry try again" << endl;
}
else
{
count++;
}
}//^^this one is missing
for(int i=0;i 你没有为
-循环关闭第三个的块。你没有为
-循环关闭第三个的块。你应该使用
头来生成伪随机数。这很奇怪,我的}在for语句中为什么我的IDE没有显示我有语法错误?你应该使用
头生成伪随机数。这很奇怪,我在for语句中缺少了我的}为什么我的IDE没有显示我有语法错误?