由于某种原因,即使我没有将它分配给数组中的一组数字,也会输出“0”。我怎样才能摆脱零?
#include <iostream>
#include <time.h>
#include <string>
using namespace std;
int n;
int size=10;
int setNums[10];
int main()
{
string ans = "";
do {
for (int n=0; n<size;n++ )
{
setNums[size] = n+1;\
cout << setNums[size] << endl;
}
srand (time(NULL));
int choice = rand() % setNums[size];
cout << choice << endl;
cout << "Keep guessing?" << endl;
cin >> ans;
} while (ans == "Y");
cout << "\n\n...Press ENTER to Exit System...";
cin.get();
return 0;