gpt4 book ai didi

C++乐透号码生成器

转载 作者:太空宇宙 更新时间:2023-11-04 16:15:58 26 4
gpt4 key购买 nike

<分区>

我正在开发一个程序,该程序必须生成 0-9 之间的 5 个随机数的数组,然后我必须要求用户输入 0-9 之间的 5 个数字并将其存储在数组中,然后比较它们并显示如果他们都做对了。我把它都写出来了,但它一直给我这个错误

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;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com