Educational
08/09/2014
C++ Program
(Voting)
main()
{
float john,smith,abs,totv,y,z,i;
printf("\n\n\t enter the number of votes for john:\n\t ");
scanf("%f",&john);
printf("\n\t enter the number of votes for smith:\n\t ");
scanf("%f",&smith);
printf("\n\t enter the number of abstension:\n\t ");
scanf("%f",&abs);
printf("\n\n\n\n\t number who vote john: %.2f",john);
printf("\n\t number who vote smith: %.2f",smith);
printf("\n\t number of abstain voter: %.2f\n\n",abs);
totv=john+smith+abs;
y=(john/totv)*100;
z=(smith/totv)*100;
i=(abs/totv)*100;
printf("\n\t total voters: %.2f voters.",totv);
printf("\n\n\t the percent who vote john: %.2f percent.",y);
printf("\n\t the percent who vote smith: %.2f percent.",z);
printf("\n\t percent of abstention: %.2f percent.\n\n",i);
if (john>smith) {
printf("\n\t the winner is JOHN !!!! \n\n\n\n\n ",john);
}
else if (smith>john){
printf("\n\t the winner is SMITH !!!!\n\n\n\n ",smith);
}
else if (john==smith){
printf("\n\t NOBODY WIN !!!!\n\n\n\n\n");
}
}
Click here to claim your Sponsored Listing.
Category
Telephone
Website
Address
Sitio Sto Nino Purok 2
Catbalogan
6700