Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

#include using namespace std; int main() { int const votingStations=4; int votesChiefs =0; int voteBucs =0; int votePlats =0; int spoiltvotes =0; char vote=0; int voter; int cCount=0; int bCount=0; int pCount=0; int sCount=0; for (int count=1; count =4; count++) { while (votingstations =4) { cout<<"which candidate are you voting for?">candidate; switch ( voters) { case 'chiefs': case 'c': cCount++; break; case 'bucs': case 'b': bCount++; break; c

OpenStudy (anonymous):

please help

OpenStudy (anonymous):

There are some issues with your code. The first is the way you try to compare a variable with a number. In C++, if you say e.g. `count = 4`, you will assign the value of 4 to the variable count. If you want to check whether count is equal to 4, you'll need to use `==` instead of `=`. In the while loop, you want to check whether or not votingstations equals 4. Since votingstations is a constant, this will always be the case, so you have an infinite loop. `candidate` and `voters` are variables that are not defined in the bit of code you posted. Finally, you can't really compare strings (like `"chiefs"`, strings should be between `"`s) in a switch statement, I think. Nice job so far. There're still some minor issues, but you'll sort them out :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!