Voting simulator in c++

I'm trying to tweak this template to have the '*' output instead of the percentage.

[code]
#include <iostream>
#include <string>
using namespace std;

void InitializeData();

int main()
{
InitializeData();
cout<<endl;

return 0;


}

void InitializeData()
{
string array1[1000];
int n;
int counter;
int votes[10000];

cout<<"how many candidates are you counting: ";
cin>>n;

while(n<2 || n>10)
{
cout<<endl;
cout<<"Please enter between 2 and 10 candidates";
cin>>n;
}


cout<<endl<<"Please Enter Their Names:";
cout<<endl;
for( counter=0; counter<n; counter++)
{
cin>> array1[counter];
cout<<endl;
}
cout<<"Enter The Amount Of Votes For Each Candidate";
for( counter=0; counter<n; counter++)
{
cin>> votes[counter];
cout<<endl;
}
cout<<"Your candidates are as follows"<<endl<<endl;
for( counter=0; counter<n; counter++)
{
cout<<array1[counter];
cout<<endl;



}
int totalVotes = 0;
for (counter = 0; counter < n; counter++)
{
totalVotes += votes[counter];
}

cout << "The vote percentages are as follows:" << endl << endl;
for (counter = 0; counter < n; counter++)
{
cout << array1[counter] << ": " << static_cast<float>(votes[counter])/static_cast<float>(totalVotes) * 100 << endl;
}

}
it should be a random lol
It's supposed to be a voting simulator lol
Topic archived. No new replies allowed.