C program calculating voter demographics by zipcode won't compile

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Marta
Messages
4
Reaction score
0
#include<stdio.h>
main()
{
int zipcode,numdem,numrep,sum ;
double perdem, perrep;

While(zipcode!= -1111){
printf("please enter zipcode");
scanf("%d",&zipcode);
printf("please enter numdem)'
scanf("%d",&numdem);
printf("please enter numrep");
scanf("%d",&numrep);
zipcode, zipcoderep;max amountregisvoters
sum=numdem+numrep;district=district+1
perdem=(dem/totalregvoters)*100;
perrep=(rep/totalregvoters)*100;
if(dem<rep)
printf("there are more republicans");
if(dem>rep)
printf("there are more democrats");
if(dem==rep)
printf("the number of democrats and republicans are the same");
printf("\n\n\n\n\n");
}
return0
}
 
Last edited:
Physics news on Phys.org
When you're posting code, indent and use the
Code:
 tags.
You could start by making sure that:
1. The open and close quotes for everything are where you want them to be.
2. There are semicolons in all appropriate places.

Both of these are common and, in your example rather obvious issues. 

For example:
[QUOTE]
printf("please enter numdem)'
[/QUOTE]

Moreover, what is this line supposed to do?
[QUOTE]
zipcode, zipcoderep;max amountregisvoters
[/QUOTE]