#include <iostream>
#include <string>
using namespace std;
int userToVote[20][3];
int vote,number;
int main()
{
for(int i = 0;i<20;i++)
{
for(int z = 0;z<3;z++)
{
cout << "Hello player "<< i << "Insert the id you want to vote and the vote (0 or 1) ";
cin >> number >> vote;
cout << userToVote[number][vote];
}
}
}
答案 0 :(得分:0)
由于player
可以投票3次。每次投票时你都可以增加userToVote[number][vote]
。这样,投票就可以增加。你可以像这样更改你的代码。 / p>
cout << "Hello player "<< i << "Insert the id you want to vote and the vote (0 or 1) ";
cin >> number >> vote;
userToVote[number][vote]+=1;
cout << userToVote[number][vote];