Popular Posts

6/25/2012

Election in Country C Programming

Download Here

Code Here :
================================

#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
 void main()
 {
clrscr();
void run();
void draw();
gotoxy(27,3) ; printf("The Election in Country A");
gotoxy(7,10) ; printf("Party A");
gotoxy(26,10); printf("Party B");
gotoxy(46,10); printf("Party C");
gotoxy(65,10); printf("Party D");
draw();
run();
getch();
 }
 void run ()
 {
char pv;
int A,B,C,D,total,i;
char com(int,int,int,int);
A=0;
B=0;
C=0;
D=0;

while (1)
{
if(pv=='a' || pv=='A') A++;
if(pv=='b' || pv=='B') B++;
if(pv=='c' || pv=='C') C++;
if(pv=='d' || pv=='D') D++;
if(pv==13) break;
total=A+B+C+D;
gotoxy(8,15) ; printf("%5d",A);
gotoxy(27,15); printf("%5d",B);
gotoxy(47,15); printf("%5d",C);
gotoxy(66,15); printf("%5d",D);
gotoxy(5,26) ; printf("Total People=%4d",total);  pv=getch();
}

delay(500); gotoxy(3,30) ; printf("Party A has %d votes",A);
delay(500); gotoxy(3,32) ; printf("Party B has %d votes",B);
delay(500); gotoxy(3,34) ; printf("Party C has %d votes",C);
delay(500); gotoxy(3,36) ; printf("Party D has %d votes",D);
delay(500); gotoxy(25,40);
printf("Party %c Win The Election",com(A,B,C,D));
 }
 char com(int A,int B,int C,int D)
 {
int ma=A;
char max='A';
if(ma<B) {ma=B; max='B';}
if(ma<C) {ma=C; max='C';}
if(ma<D) {ma=D; max='D';}
return max;
 }
 void draw()
 {
for (int a=0;a<76;a++)
{
gotoxy(a+1,7) ; printf("%c",205);
gotoxy(a+1,20); printf("%c",205);
}

for (a=1;a<=5;a++)
{
gotoxy(a+7,16) ; printf("%c",196);
gotoxy(a+26,16); printf("%c",196);
gotoxy(a+46,16); printf("%c",196);
gotoxy(a+65,16); printf("%c",196);
gotoxy(a+7,14) ; printf("%c",196);
gotoxy(a+26,14); printf("%c",196);
gotoxy(a+46,14); printf("%c",196);
gotoxy(a+65,14); printf("%c",196);
}

for (a=0;a<14;a++)
{
gotoxy(1,a+7) ; printf("%c",186);
gotoxy(77,a+7); printf("%c",186);
gotoxy(19,a+7); printf("%c",186);
gotoxy(39,a+7); printf("%c",186);
gotoxy(59,a+7); printf("%c",186);
}

gotoxy(1,7)  ; printf("%c",201);
gotoxy(1,20) ; printf("%c",200);
gotoxy(77,7) ; printf("%c",187);
gotoxy(77,20); printf("%c",188);
gotoxy(19,7) ; printf("%c",203);
gotoxy(39,7) ; printf("%c",203);
gotoxy(59,7) ; printf("%c",203);
gotoxy(19,20); printf("%c",202);
gotoxy(39,20); printf("%c",202);
gotoxy(59,20); printf("%c",202);
gotoxy(7,16) ; printf("%c",192);
gotoxy(7,14) ; printf("%c",218);
gotoxy(13,16); printf("%c",217);
gotoxy(13,14); printf("%c",191);
gotoxy(26,16); printf("%c",192);
gotoxy(26,14); printf("%c",218);
gotoxy(32,16); printf("%c",217);
gotoxy(32,14); printf("%c",191);
gotoxy(46,16); printf("%c",192);
gotoxy(46,14); printf("%c",218);
gotoxy(52,16); printf("%c",217);
gotoxy(52,14); printf("%c",191);
gotoxy(65,16); printf("%c",192);
gotoxy(65,14); printf("%c",218);
gotoxy(71,16); printf("%c",217);
gotoxy(71,14); printf("%c",191);
gotoxy(7,15) ; printf("%c",179);
gotoxy(46,15); printf("%c",179);
gotoxy(65,15); printf("%c",179);
gotoxy(26,15); printf("%c",179);
gotoxy(32,15); printf("%c",179);
gotoxy(52,15); printf("%c",179);
gotoxy(13,15); printf("%c",179);
gotoxy(71,15); printf("%c",179);
 }

//leave a command and share it to your friends ..!


0 comments:

Post a Comment