real life case study examples in C programming language for beginers and professionals.


The software allows candidates to access their profile and provide all their information, including previous milestones. The manager can see the details and documents of each member; only then will the member ID and password be obtained and the wrong account can be deleted. Voters can find the list of candidates in their region through the program. The administrator has full control over the system and can edit and delete any information that is not related to the election rules.


Source Code:

#include<stdio.h>
#define CANDIDATE_COUNT
#define CANDIDATE1 "Raj Yadav"
#define CANDIDATE2 "Krish Mehta"
#define CANDIDATE3 "Larry Page"
#define CANDIDATE4 "Anand Rai"
int vCnt1=0, vCnt2=0, vCnt3=0, vCnt4=0, splVts=0;
void castVote(){
int choice;
printf("\n\n ### Please choose your Candidate ####\n\n");
printf("\n 1. %s", CANDIDATE1);
printf("\n 2. %s", CANDIDATE2);
printf("\n 3. %s", CANDIDATE3);
printf("\n 4. %s", CANDIDATE4);
printf("\n 5. %s", "None of These");
printf("\n\n Input your choice (1 - 4) : ");
scanf("%d",&choice);
switch(choice){
case 1: vCnt1++; break;
case 2: vCnt2++; break;
case 3: vCnt3++; break;
case 4: vCnt4++; break;
case 5: splVts++; break;
default: printf("\n Error: Wrong Choice !! Please retry");
//hold the screen
getchar();
}
printf("\n thanks for vote !!");
}
void votesCount(){
printf("\n\n ##### Voting Statics ####");
printf("\n %s - %d ", CANDIDATE1, vCnt1);
printf("\n %s - %d ", CANDIDATE1, vCnt2);
printf("\n %s - %d ", CANDIDATE1, vCnt3);
printf("\n %s - %d ", CANDIDATE1, vCnt4);
printf("\n %s - %d ", "Spoiled Votes", splVts);
}
void getLeadingCandidate(){
printf("\n\n #### Leading Candiate ####\n\n");
if(vCnt1>vCnt2 && vCnt1>vCnt3 && vCnt1 >vCnt4)
 printf("[%s]",CANDIDATE1);
else if (vCnt2>vCnt3 && vCnt2>vCnt4 && vCnt2 >vCnt1)
 printf("[%s]",CANDIDATE2);
else if(vCnt3>vCnt4 && vCnt3>vCnt2 && vCnt3 >vCnt1)
 printf("[%s]",CANDIDATE3);
else if(vCnt4>vCnt1 && vCnt4>vCnt2 && vCnt4 >vCnt3)
 printf("[%s]",CANDIDATE4);
else
 printf("----- Warning !!! No-win situation----");
}
int main()
{
int i;
int choice;
do{
 printf("\n\n ###### Welcome to Election/Voting 2019 #####");
  printf("\n\n 1. Cast the Vote");
 printf("\n 2. Find Vote Count");
 printf("\n 3. Find leading Candidate");
 printf("\n 0. Exit");
 printf("\n\n Here is Your Choice menu. \n Enter Your choice between 1-4 : ");
 scanf("%d", &choice);
 switch(choice)
 {
  case 1: castVote();break;
  case 2: votesCount();break;
  case 3: getLeadingCandidate();break;
  default: printf("\n Error: Invalid Choice");
 }
}while(choice!=0);
 //hold the screen
   return 0;
}



Previous Topic:-->>DMA Assignments || Next topic:-->>Basic MCQ in C.