This is Simple C Program to vote ‘A’ or ‘B’ if not vote goes to Invalid.
#include<stdio.h>
void main()
{
int a=0, b=0, o=0, i;
char v;
printf("\tPress A or B\n");
for(i=1; i<=5; i++)
{
printf("\n\nVoter no. %d ",i);
printf("Enter Vote :");
v=getche();
v=toupper(v);
if(v=='A')
a++;
else if(v=='B')
b++;
else
o++;
}
printf("\n\n Status of vote(s) \n");
printf("\nA Secures %d Vote(s).",a);
printf("\nB Secures %d Vote(s).",b);
printf("\nInvalid Vote(s) %d.",o);
getch();
}
For Online Classes WhatsApp (Dipu Sir) :- 8404801234
i like it but can someone use another attribute other than getch