Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To combat election fraud, your city is instituting a new voting procedure. The b

ID: 3879821 • Letter: T

Question

To combat election fraud, your city is instituting a new voting procedure. The ballot has a letter associated with every selection a voter may make. A sample ballot is shown:-

(Voter places a tick next to his or her preferred candidate, proposition and measure to indicate his/her vote)

1. VOTE FOR MAYOR

   A. Pincher, Penny

B. Dover, Skip

C. Perman, Sue

2. PROPOSITION 17

  D. YES

E. NO

3. MEASURE 1

  F. YES

G. NO

4. MEASURE 2

H. YES

I NO

After submitting the ballot, every voter receives a receipt that has a unique ID number and a record of the voting selections. For example, a voter who submits a vote for Sue, Perman, Yes on Proposition 17, No on Measure 1 and Yes on Measure 2 might receive a receipt with:-

ID 4925 : CDGH

The next day, the city posts all votes on its web page sorted by ID Number. This allows a voter to confirm their submission and allows anyone to count the vote totals for themselves. A sample list of for the sample ballot is shown below:-

Write a program that reads the posted voting list from a file named list.txt (file included as part of Week 4 Assessments) and outputs the percent of votes cast for each ballot item. File contains a list of Id numbers and a string containing votes (column B from the table).

Task:-

Define a class named Voter that stores an individuals voting record. The class should have a constructor that takes as input a string of votes for example "CDGH", a voter Id, an accessor function(s) that return the person's Id and vote for a specific question. Store each Voter instance in an array or vector.

Your program should iterate over the array to compute and output the percent of votes cast for each candidate, proposition and measure. It should then prompt the user to enter a voter Id, iterate over the list again to find the object with that ID and print his or her votes.

PLease write this code in c++!

ID VOTES 4925 CDGH 4926 AEGH 4927 CDGI 4928 BEGI 4929 ADFH

Explanation / Answer

#include<iostream.h>

#include<fstream.h>

#include<process.h>

#include<string.h>

#include<stdlib.h>

#include<stdio.h>

#include<ctype.h>

#include<conio.h>

#include<dos.h>

char description()

{ delay(2000);

cout<<" ELECTION VOTING SOFTWARE ";

delay(500);

cout<<" DESCRIPTION : IN THIS PROJECT , A PREDETERMINED SET OF ";

delay(500);

cout<<" VOTERS WILL BE ABLE TO CAST THE VOTE .VOTERS WILL HAVE ";

delay(500);

cout<<" TO PROVE THEIR IDENTITY BY GIVING THEIR IDENTIFICATION ";

delay(500);

cout<<" NO. A AUTHENTICATED USER WILL BE ABLE TO CAST THE VOTE. ";

delay(500);

cout<<" A USER WHO HAS CASTED THE VOTE CANNOT CAST AGAIN.AFTER ";

delay(500);

cout<<" VOTING HAS FINISHED RESUTS WILL BE DECLAIR. A SETUP ";

delay(500);

cout<<" OPTION BEFORE ELECTION STARTS , WILL ALLOW VOTER TO BE ";

delay(500);

cout<<" CREATED AND CANDIDATE CHOOSEN. ";

delay(1500);

cout<<" PLEASE PRESS ENTER TO CONTINUE & Esc. TO EXIT ";

char ch;

for(;;)

{

ch=getch();

if(ch==13)

break;

else

if(ch==27)

exit(-1);

else

cout<<"  ! WRONG KEY ENTERED !";

delay(300);

cout<<" PRESS ENTER ";

}

return 0;

}

int pass()

{

char ch;

int r=0;

char pass[20];

for(;;)

{

clrscr();

gotoxy(16,20);

cout<<"Enter the password to initialize the setup :";

r=0;

for(int i=0;;i++)

{

ch=getch();

if(ch==13)

{ pass[r]='';

break;

}

if(ch==8)

{

if(i>0)

{ cout<<ch<<" "<<ch;

i-=2;r--;

}

else

i--;

}

else

{ cout<<"*";

pass[r]=ch;

r++;

}

}

if(strcmp("divakar",pass)==0)

return 0;

else

{

cout<<" !! INVALID PASSWORD !!";

delay(300);

cout<<" --> TRY AGAIN";

getch();

}

}

}

//**********************************************************

// THIS FUNCTION TRUE WHEN THE STRING PASSED AS ARGUMENT IS

// IS NUMBER

//**********************************************************

int string_is_number(char* s)

{

int size = strlen(s);

for(int i = 0; i < size; i++)

if (!(s[i] >= '0' && s[i] <= '9'))

return 0;

return 1;

}

class candidate_record

{

public:

int candidate_namecode ;

char candidate_name[50] ;

char partyname[50], partysign[50] ;

char summary[1];

char revenue[100];

char age[100];

char area[50];

};

class voter_record

{

public:

int voter_namecode ;

char voter_name[50] ;

char age[10], gender[10] ;

};

class voter_status

{

public:

int voter_namecode;

int voting_status;

};

class candidate_status

{

public:

int candidate_namecode;

int numVotes;

};

//**********************************************************

// CLASS NAME : vote

// DETAILS : IT CONTROLLS OVER ALL THE FUNCTIONS

// RELATED TO VOTING ITEMS

//**********************************************************

class vote

{

public :

void add_candidate_name(void) ;

void delete_candidate_name(void) ;

void modify_candidate_name(void) ;

void list_of_candidate_names(void) ;

void voting(void) ;

void add_voter_name(void) ;

void delete_voter_name(void) ;

void modify_voter_name(void) ;

void list_of_voters_names(void) ;

private :

int last_candidate_code(int &num_candidates) ;

void delete_candidate_record(int) ;

void modify_candidate_record(int) ;

void display_candidate_record(int) ;

int name_candidate_found(int) ;

int candidate_recordno(int, candidate_record&) ;

void candidate_sort(void) ;

int last_voter_code(int &num_voters) ;

void delete_voter_record(int) ;

void modify_voter_record(int) ;

void display_voter_record(int) ;

int name_voter_found(int) ;

int voter_recordno(int, voter_record &vr) ;

void voter_sort(void) ;

voter_status* init_voter_status(int &num);

candidate_status* init_candidate_status(int &num);

} ;

//**********************************************************

// CLASS NAME : menu

// DETAILS : IT CONTROLLS OVER ALL THE FUNCTIONS

//**********************************************************

class menu

{

public :

void main_menu(void) ;

private :

void edit_menu(void) ;

vote v;

} ;

//**********************************************************

// THIS FUNCTION CREATE MAIN MENU AND CALLS OTHER FUNCTIONS

//**********************************************************

void menu :: main_menu(void)

{

clrscr() ;

char ch ;

while (1)

{

clrscr();

gotoxy(27,4) ;

cout<<" E L E C T I O N ";

gotoxy(27,6);

cout <<" V O T I N G S O F T W A R E " ;

gotoxy(31,8) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(32,9) ;

cout <<"1: VOTE " ;

gotoxy(32,11) ;

cout <<"2: SEE MENU " ;

gotoxy(32,13) ;

cout <<"3: EDIT " ;

gotoxy(32,17) ;

cout <<"0: QUIT " ;

gotoxy(32,20) ;

cout <<"Enter Choice : " ;

ch = getche() ;

if (ch == 27)

return ;

else

if (ch == '1')

{

vote v ;

v.voting() ;

}

else

if (ch == '2')

{

vote v ;

v.list_of_candidate_names() ;

gotoxy(1,20) ;

cout <<"Press any key to see the voters details" ;

getche() ;

v.list_of_voters_names();

}

else

if (ch == '3')

edit_menu() ;

else

if (ch == '0')

break ;

}

}

//**********************************************************

// THIS FUNCTION CREATE EDIT MENU AND CALLS OTHER FUNCTIONS

//**********************************************************

void menu :: edit_menu(void)

{

clrscr();

char ch,choice;

cout<<" EDIT MENU ";

cout<<" 1: * EDIT CANDIDATE RECORD * ";

cout<<" 2: * EDIT VOTER RECORD * ";

cout<<" 0: * EXIT * ";

cout<<" ENTER CHOICE: ";

choice = getche();

if (choice == '1')

{

while(1)

{

gotoxy(28,10) ;

cout <<" * EDIT CANDIDATE RECORD *" ;

gotoxy(28,12) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(28,14) ;

cout <<"1: * ADD CANDIDATE NAME * " ;

gotoxy(28,16) ;

cout <<"2: * MODIFY CANDIDATE NAME *" ;

gotoxy(28,18) ;

cout <<"3: * DELETE CANDIDATE NAME *" ;

gotoxy(28,20) ;

cout <<"0: * EXIT *" ;

gotoxy(28,22) ;

cout <<" ENTER CHOICE: " ;

ch = getche() ;

if (ch == '1')

{

vote v ;

v.add_candidate_name() ;

break ;

}

else if (ch == '2')

{

vote v ;

v.modify_candidate_name() ;

break ;

}

else if (ch == '3')

{

vote v ;

v.delete_candidate_name() ;

break ;

}

else

if (ch == '0')

break ;

}

}

if(choice=='2')

{

while (1)

{

gotoxy(28,10) ;

cout <<" * EDIT VOTER RECORD *" ;

gotoxy(28,12) ;

cout <<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(28,14) ;

cout <<"1: * ADD VOTER NAME * " ;

gotoxy(28,16) ;

cout <<"2: * MODIFY VOTER NAME * " ;

gotoxy(28,18) ;

cout <<"3: * DELETE VOTER NAME * " ;

gotoxy(28,20) ;

cout <<"0: * EXIT " ;

gotoxy(28,22) ;

cout <<"Enter Choice: " ;

ch = getche() ;

if (ch == '1')

{

vote v ;

v.add_voter_name() ;

break ;

}

else if (ch == '2')

{

vote v ;

v.modify_voter_name() ;

break ;

}

else if (ch == '3')

{

vote v ;

v.delete_voter_name() ;

break ;

}

else if (ch == '0')

break ;

}

}

}

//**********************************************************

// THIS FUNCTION RETURNS THE CODE OF THE LAST RECORD OF THE

// VOTER IN THE VOTER FILE (VOTER.DAT).

//**********************************************************

int vote :: last_voter_code(int &num_voters)

{

voter_record vr;

fstream file ;

num_voters = 0;

file.open("VOTER.DAT", ios::in|ios::binary) ;

file.seekg(0,ios::beg) ;

int t=0 ;

while (file.read((char *)&vr,sizeof(voter_record)))

{

t = vr.voter_namecode ;

num_voters++;

}

file.close() ;

return t ;

}

//**********************************************************

// THIS FUNCTION DISPLAY THE LIST OF THE NAMES OF VOTERS

//**********************************************************

void vote :: list_of_voters_names(void)

{

clrscr() ;

voter_record vr;

fstream file ;

file.open("VOTER.DAT", ios::in|ios::binary) ;

file.seekg(0) ;

int row = 6 , found = 0 , pageno = 1 ;

gotoxy(30,2) ;

cout <<"LIST OF NAMES OF VOTERS" ;

gotoxy(29,3) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(3,4) ;

cout <<"NAME CODE NAME AGE GENDER" ;

gotoxy(2,5) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

while (file.read((char *)&vr, sizeof(voter_record)))

{

delay(20) ;

found = 1 ;

gotoxy(5,row) ;

cout <<vr.voter_namecode ;

gotoxy(14,row) ;

cout <<vr.voter_name ;

gotoxy(37,row) ;

cout <<vr.age;

gotoxy(51,row) ;

cout <<vr.gender; ;

if ( row == 22 )

{

row = 5 ;

gotoxy(66,1) ;

cout <<"Page no. : " <<pageno ;

gotoxy(66,2) ;

cout <<"===============" ;

pageno++ ;

gotoxy(1,25) ;

cout <<"Press any key to continue..." ;

getche() ;

clrscr() ;

gotoxy(3,4) ;

cout << "NAME CODE NAME AGE GENDER " ;

gotoxy(2,5) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

}

else

row++ ;

}

if ( !found )

{

gotoxy(5,10) ;

cout <<"Records not found " ;

}

gotoxy(66,1) ;

cout <<"Page no. : " <<pageno ;

gotoxy(66,2) ;

cout <<"===============" ;

gotoxy(1,20) ;

cout <<"Press any key to continue..." ;

getche() ;

file.close () ;

}

//**********************************************************

// THIS FUNCTION ADD RECORDS IN THE VOTER FILE (VOTER.DAT)

//**********************************************************

void vote :: add_voter_name(void)

{

voter_record vr;

int vcode, valid ;

char ch;

int num_voters;

vcode = last_voter_code(num_voters) ;

vcode++ ;

do

{

clrscr() ;

gotoxy(71,2) ;

cout <<"<0>=Exit" ;

gotoxy(23,3) ;

cout <<" ADD NAME TO THE VOTER LIST" ;

gotoxy(23,4) ;

cout <<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(5,6) ;

cout <<"Name Code : " <<vcode ;

gotoxy(5,8) ;

cout <<"Name: " ;

gotoxy(5,10) ;

cout <<"Age: " ;

gotoxy(5,12) ;

cout <<"Gender: " ;

do

{

valid = 1 ;

gotoxy(1,8) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER NAME OF THE VOTER TO ADD IN THE LIST" ;

gotoxy(5,8) ;

cout <<" Name : " ;

gets(vr.voter_name) ;

strupr(vr.voter_name) ;

if (vr.voter_name[0] == '0')

return ;

if ((strlen(vr.voter_name) < 1) || (strlen(vr.voter_name) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A...Z" ;

getch() ;

}

} while (!valid) ;

do

{

valid = 1 ;

gotoxy(1,10) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER AGE OF VOTER TO ADD IN THE LIST" ;

gotoxy(5,10) ;

cout <<"Age : " ;

gets(vr.age) ;

strupr(vr.age);

if (vr.age[0] == '0')

return ;

if ((strlen(vr.age) < 1) || (strlen(vr.age) > 3 ) || (!string_is_number(vr.age)))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = 18...100" ;

getch() ;

}

if (atoi(vr.age) < 18)

{

valid = 0;

gotoxy(3,24);

cout <<" Voter's age is less than 18";

getch();

}

} while (!valid) ;

do

{

valid = 1 ;

gotoxy(1,12) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER GENDER OF VOTER TO ADD IN THE MENU" ;

gotoxy(5,12) ;

cout <<"GENDER : " ;

gets(vr.gender) ;

strupr(vr.gender);

if (vr.gender[0] == '0')

return ;

if ((strlen(vr.gender) < 1) ||(strlen(vr.gender) > 1)

|| (strcmp(vr.gender,"M") && strcmp(vr.gender,"F")))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = M/F" ;

getch() ;

}

} while (!valid) ;

do

{

gotoxy(1,15) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,15) ;

cout <<"Do you want to save this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'Y')

{

vr.voter_namecode = vcode ;

fstream file ;

file.open("VOTER.DAT", ios::out | ios::app |ios::binary) ;

file.write((char *)&vr, sizeof(voter_record)) ;

file.close() ;

vcode++ ;

}

do

{

gotoxy(1,17) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,17) ;

cout <<"Do you want to add more records (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

} while (ch == 'Y') ;

}

//**********************************************************

// THIS FUNCTION DISPLAY THE RECORD OF THE GIVEN CODE FROM

// THE VOTER FILE (VOTER.DAT)

//**********************************************************

void vote :: display_voter_record(int vcode)

{

voter_record vr;

fstream file ;

file.open("VOTER.DAT", ios::in|ios::binary) ;

file.seekg(0,ios::beg) ;

while (file.read((char *)&vr, sizeof(voter_record)))

{

if (vr.voter_namecode == vcode)

{

gotoxy(5,3) ;

cout <<"Name Code : "<<vr.voter_namecode ;

gotoxy(5,4) ;

cout <<"Name : "<<vr.voter_name ;

gotoxy(5,5) ;

cout <<"Age : "<<vr.age ;

gotoxy(5,6) ;

cout <<"Gender : "<<vr.gender ;

break ;

}

}

file.close() ;

}

//**********************************************************

// THIS FUNCTION RETURN THE VALUE 1 IF THE RECORD IS FOUND

// FOR THE GIVEN CODE IN THE VOTER FILE (VOTER.DAT)

//**********************************************************

int vote :: name_voter_found(int tcode)

{

voter_record vr;

fstream file ;

file.open("VOTER.DAT", ios::in|ios::binary) ;

file.seekg(0,ios::beg) ;

int found=0 ;

while (file.read((char *)&vr, sizeof(voter_record)))

{

if (vr.voter_namecode == tcode)

{

found++ ;

break ;

}

}

file.close() ;

return found ;

}

//**********************************************************

// THIS FUNCTION RETURN THE RECORD NO. OF THE GIVEN CODE IN

// THE VOTER FILE (VOTER.DAT)

//**********************************************************

int vote :: voter_recordno(int tcode, voter_record &vr)

{

voter_record temp;

fstream file ;

file.open("VOTER.DAT", ios::in|ios::binary) ;

file.seekg(0,ios::beg) ;

int found=0 ;

while (file.read((char *)&temp, sizeof(voter_record)))

{

found++ ;

if (temp.voter_namecode == tcode)

{

vr = temp;

break ;

}

}

file.close() ;

return found ;

}

//**********************************************************

// THIS FUNCTION DELETES THE RECORD FOR THE GIVEN CODE FROM

// THE VOTER FILE (VOTER.DAT)

//**********************************************************

void vote :: delete_voter_record(int tcode)

{

voter_record vr;

fstream file ;

file.open("VOTER.DAT", ios::in|ios::binary) ;

fstream temp ;

temp.open("temp.dat", ios::out|ios::binary) ;

file.seekg(0,ios::beg) ;

while ( !file.eof() )

{

file.read((char *)&vr, sizeof(voter_record)) ;

if ( file.eof() )

break ;

if ( vr.voter_namecode != tcode )

temp.write((char *)&vr, sizeof(voter_record)) ;

}

file.close() ;

temp.close() ;

file.open("VOTER.DAT", ios::out|ios::binary) ;

temp.open("temp.dat", ios::in|ios::binary) ;

temp.seekg(0,ios::beg) ;

while ( !temp.eof() )

{

temp.read((char *)&vr, sizeof(voter_record)) ;

if ( temp.eof() )

break ;

file.write((char *)&vr, sizeof(voter_record)) ;

}

file.close() ;

temp.close() ;

}

//**********************************************************

// THIS FUNCTION GIVES THE CODE NO. TO DELETE RECORD FROM

// THE VOTER FILE (VOTER.DAT)

//**********************************************************

void vote :: delete_voter_name(void)

{

clrscr() ;

char t_code[5], ch ;

int tcode ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to see the list" ;

gotoxy(5,3) ;

cout <<"Enter Name Code of the item to be deleted : " ;

gets(t_code) ;

tcode = atoi(t_code) ;

if (tcode == 0)

{

list_of_voters_names() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to Exit" ;

gotoxy(5,24) ;

cout <<"Enter Name Code of the item to be deleted : " ;

gets(t_code) ;

tcode = atoi(t_code) ;

if (tcode == 0)

return ;

}

clrscr() ;

if (!name_voter_found(tcode))

{

gotoxy(5,5) ;

cout <<"Record not found" ;

getch() ;

return ;

}

display_voter_record(tcode) ;

do

{

gotoxy(1,8) ; clreol() ;

gotoxy(5,8) ;

cout <<"Do you want to delete this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'N')

return ;

delete_voter_record(tcode) ;

gotoxy(5,15) ;

cout <<"Record Deleted" ;

getch() ;

}

//**********************************************************

// THIS FUNCTION MODIFY THE RECORD FOR THE GIVEN CODE FROM

// THE VOTER FILE (VOTER.DAT)

//**********************************************************

void vote :: modify_voter_record(int tcode)

{

voter_record vr;

int recno ;

recno = voter_recordno(tcode,vr) ;

if (recno == 0)

return;

int valid, t_code ;

char ch,t_namecode[5] ;

gotoxy(71,2) ;

cout <<"<0>=Exit" ;

gotoxy(5,12) ;

cout <<"Name Code : " ;

gotoxy(5,14) ;

cout <<" Name : " ;

gotoxy(5,16) ;

cout <<" Age : " ;

gotoxy(5,18) ;

cout <<"Gender: " ;

do

{

gotoxy(20,12) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,12) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER NAME CODE TO ADD IN THE MENU" ;

gotoxy(5,12) ;

cout <<"Name Code : " ;

gets(t_namecode) ;

vr.voter_namecode = atoi(t_namecode) ;

if (vr.voter_namecode == 0)

return ;

if (name_voter_found(vr.voter_namecode) && vr.voter_namecode != tcode)

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" CODE ALREADY GIVEN" ;

getch() ;

}

}

do

{

gotoxy(20,14) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,14) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER NAME TO ADD IN THE MENU" ;

gotoxy(5,14) ;

cout <<" Name : " ;

gets(vr.voter_name) ;

strupr(vr.voter_name) ;

if (vr.voter_name[0] == '0')

return ;

if ((strlen(vr.voter_name) < 1) || (strlen(vr.voter_name) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = 1..50" ;

getch() ;

}

}

do

{

gotoxy(20,16) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,16) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER AGE OF VOTER TO ADD IN THE MENU" ;

gotoxy(5,16) ;

cout <<"Age : " ;

gets(vr.age) ;

strupr(vr.age);

if (vr.age[0] == '0')

return ;

if ((strlen(vr.age) < 1) || (strlen(vr.age) > 10) || !string_is_number(vr.age))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = 1..10" ;

getch() ;

}

}

do

{

gotoxy(20,18) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,18) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER GENDER OF VOTER TO ADD IN THE MENU" ;

gotoxy(5,18) ;

cout <<"Gender : " ;

gets(vr.gender) ;

strupr(vr.gender);

if (vr.gender[0] == '0')

return ;

if ((strlen(vr.gender) < 1) || (strlen(vr.gender) > 10))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = " <<vr.gender <<"..10" ;

getch() ;

}

}

do

{

gotoxy(1,21) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,21) ;

cout <<"Do you want to save this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'N')

return ;

getch() ;

fstream file ;

file.open("VOTER.DAT", ios::out | ios::ate|ios::binary) ;

int location ;

location = (recno-1) * sizeof(vr) ;

cout << " Location is " << location;

file.seekp(location) ;

file.write((char *) &vr, sizeof(voter_record)) ;

file.close() ;

voter_sort() ;

clrscr() ;

gotoxy(5,15) ;

cout <<"Record Modified" ;

getch() ;

}

//**********************************************************

// THIS FUNCTION GIVES THE CODE NO. TO MODIFY RECORD FROM

// THE VOTER FILE (VOTER.DAT)

//**********************************************************

void vote :: modify_voter_name(void)

{

clrscr() ;

char t_code[5], ch ;

int tcode ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to see the list" ;

gotoxy(5,3) ;

cout <<"Enter Name Code of the item to be Modify : " ;

gets(t_code) ;

tcode = atoi(t_code) ;

if (tcode == 0)

{

list_of_voters_names() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to Exit" ;

gotoxy(5,24) ;

cout <<"Enter Name Code of the item to be modify : " ;

gets(t_code) ;

tcode = atoi(t_code) ;

if (tcode == 0)

return ;

}

clrscr() ;

if (!name_voter_found(tcode))

{

gotoxy(5,5) ;

cout <<"Record not found" ;

getch() ;

return ;

}

display_voter_record(tcode) ;

do

{

gotoxy(5,8) ;

cout <<"Do you want to Modify this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'N')

return ;

modify_voter_record(tcode) ;

}

//**********************************************************

// THIS FUNCTION SORT THE RECORD IN THE VOTER FILE (VOTER.DAT)

// ACCORDING TO THE CODE NOS.

//**********************************************************

void vote :: voter_sort(void)

{

int i=0,j ;

voter_record *arr, temp ;

fstream file ;

file.open("VOTER.DAT", ios::in|ios::binary) ;

//*************************************************************

// COUNT THE NUMBER OF RECORDS IN THE FILE

//************************************************************

while (file.read((char *) &temp, sizeof(voter_record)))

i++ ;

file.clear();

//*************************************************************

// CREATE AN ARRAY TO HOD ALL THE RECORDS

//*************************************************************

arr = (voter_record*) new voter_record[i];

int size ;

size = i ;

//*************************************************************

// SEEK THE FIE BACK TO THE BEGINNING

//*************************************************************

file.seekg(0,ios::beg) ;

//*************************************************************

// READ THE RECORDS FROM THE FILE TO THE ARRAY

//*************************************************************

for( i = 0; i < size; i++)

file.read((char*)&(arr[i]),sizeof(voter_record));

file.close() ;

for (i=1; i<size; i++)

{

for (j=0; j<size-i; j++)

{

if (arr[j].voter_namecode > arr[j+1].voter_namecode)

{

temp=arr[j];

arr[j]=arr[j+1];

arr[j+1]=temp;

}

}

}

file.open("VOTER.DAT", ios::out|ios::binary) ;

for (i=0; i<size; i++)

file.write((char *) &arr[i], sizeof(voter_record));

delete[] arr;

file.close() ;

}

//**********************************************************

// THIS FUNCTION IS THE MAIN FUNCTION CALLING THE MAIN MENU

//**********************************************************

void main(void)

{

clrscr() ;

char des;

description();

// exit();

clrscr();

char p;

pass();

clrscr();

menu m ;

m.main_menu() ;

}

//**********************************************************

// THIS FUNCTION SORT THE RECORD IN THE CANDIDATE FILE (CANDIDATE.DAT)

// ACCORDING TO THE CODE NOS.

//**********************************************************

void vote :: candidate_sort(void)

{

int i=0,j ;

candidate_record *arr, temp ;

fstream file ;

file.open("CANDIDATE.DAT", ios::in|ios::binary) ;

while (file.read((char *) &temp, sizeof(candidate_record)))

i++ ;

file.clear();

arr = (candidate_record*) new candidate_record[i];

int size ;

size = i ;

file.seekg(0,ios::beg) ;

for( i = 0; i < size; i++)

file.read((char*)&arr[i],sizeof(candidate_record));

file.close() ;

for (i=1; i<size; i++)

{

for (j=0; j<size-i; j++)

{

if (arr[j].candidate_namecode > arr[j+1].candidate_namecode)

{

temp=arr[j];

arr[j]=arr[j+1];

arr[j+1]=temp;

}

}

}

file.open("CANDIDATE.DAT", ios::out|ios::binary) ;

for (i=0; i<size; i++)

file.write((char *) &arr[i], sizeof(candidate_record));

delete[] arr;

file.close() ;

}

//**********************************************************

// THIS FUNCTION GIVES THE CODE NO. TO MODIFY RECORD FROM

// THE CANDIDATE FILE (CANDIDATE.DAT)

//**********************************************************

void vote :: modify_candidate_name(void)

{

clrscr() ;

char t_code[5], ch ;

int tcode ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to see the list" ;

gotoxy(5,3) ;

cout <<"Enter Name Code of the item to be Modify : " ;

gets(t_code) ;

tcode = atoi(t_code) ;

if (tcode == 0)

{

list_of_candidate_names() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"Press <ENTER> to Exit" ;

gotoxy(5,24) ;

cout <<"Enter Name Code of the item to be modify : " ;

gets(t_code) ;

tcode = atoi(t_code) ;

if (tcode == 0)

return ;

}

clrscr() ;

if (!name_candidate_found(tcode))

{

gotoxy(5,5) ;

cout <<"Record not found" ;

getch() ;

return ;

}

display_candidate_record(tcode) ;

do

{

gotoxy(5,8) ;

cout <<"Do you want to Modify this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'N')

return ;

modify_candidate_record(tcode) ;

}

//**********************************************************

// THIS FUNCTION MODIFY THE RECORD FOR THE GIVEN CODE FROM

// THE CANDIDATE FILE (CANDIDATE.DAT)

//**********************************************************

void vote :: modify_candidate_record(int tcode)

{

candidate_record cr;

int recno ;

int revenue;

recno = candidate_recordno(tcode,cr) ;

int valid, t_code ;

char ch,t_namecode[5] ;

gotoxy(71,2) ;

cout <<"<0>=Exit" ;

gotoxy(5,12) ;

cout <<"Name Code : " ;

gotoxy(5,14) ;

cout <<" Name : " ;

gotoxy(5,16) ;

cout <<" Party Name : " ;

gotoxy(5,18) ;

cout <<"Party Sign: " ;

gotoxy(5,20) ;

cout <<"Summary : " ;

do

{

gotoxy(20,12) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,12) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER NAME CODE TO ADD IN THE MENU" ;

gotoxy(5,12) ;

cout <<"Name Code : " ;

gets(t_namecode) ;

cr.candidate_namecode = atoi(t_namecode) ;

if (cr.candidate_namecode == 0)

return ;

if (name_candidate_found(cr.candidate_namecode) && cr.candidate_namecode != tcode)

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" CODE ALREADY GIVEN" ;

getch() ;

}

}

do

{

gotoxy(20,14) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,14) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER NAME TO ADD IN THE MENU" ;

gotoxy(5,14) ;

cout <<" Name : " ;

gets(cr.candidate_name) ;

strupr(cr.candidate_name) ;

if (cr.candidate_name[0] == '0')

return ;

if ((strlen(cr.candidate_name) < 1) || (strlen(cr.candidate_name) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = 1..50" ;

getch() ;

}

}

do

{

gotoxy(20,16) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,16) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER PARTY NAME TO ADD IN THE MENU" ;

gotoxy(5,16) ;

cout <<"Party Name : " ;

gets(cr.partyname) ;

strupr(cr.partyname);

if (cr.partyname[0] == '0')

return ;

if ((strlen(cr.partyname) < 1) || (strlen(cr.partyname) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = 1..50" ;

getch() ;

}

}

do

{

gotoxy(20,18) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,18) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER PARTY SIGN TO ADD IN THE MENU" ;

gotoxy(5,18) ;

cout <<"Party Sign : " ;

gets(cr.partysign) ;

strupr(cr.partysign);

if (cr.partysign[0] == '0')

return ;

if ((strlen(cr.partysign) < 1) || (strlen(cr.partysign) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = " <<cr.partysign <<"..50" ;

getch() ;

}

}

do

{

gotoxy(20,20) ; clreol() ;

cout <<"Change (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

valid = 0 ;

while (ch == 'Y' && !valid)

{

valid = 1 ;

gotoxy(1,20) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER THE SUMMARY OF THE CANDIDATE" ;

gotoxy(5,20) ;

cout <<"Summary declared: " ;

gets(cr.summary) ;

strupr(cr.summary);

if (cr.summary[0] == '0')

return ;

if ((strlen(cr.summary) < 1) || (strlen(cr.summary) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = " <<cr.summary <<"..50" ;

getch() ;

}

}

do

{

gotoxy(1,21) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,21) ;

cout <<"Do you want to save this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

if (ch == '0')

return ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'N')

return ;

getch() ;

fstream file ;

file.open("CANDIDATE.DAT", ios::out | ios::ate|ios::binary) ;

int location ;

location = (recno-1) * sizeof(cr) ;

file.seekp(location) ;

file.write((char *) &cr, sizeof(candidate_record)) ;

file.close() ;

candidate_sort() ;

clrscr() ;

gotoxy(5,15) ;

cout <<"Record Modified" ;

getch() ;

}

//**********************************************************

// THIS FUNCTION RETURN THE VALUE 1 IF THE RECORD IS FOUND

// FOR THE GIVEN CODE IN THE CANDIDATE FILE (CANDIDATE.DAT)

//**********************************************************

int vote :: name_candidate_found(int tcode)

{

candidate_record cr;

fstream file ;

file.open("CANDIDATE.DAT", ios::in|ios::binary) ;

file.seekg(0,ios::beg) ;

int found=0 ;

while (file.read((char *)&cr, sizeof(candidate_record)))

{

if (cr.candidate_namecode == tcode)

{

found++ ;

break ;

}

}

file.close() ;

return found ;

}

//**********************************************************

// THIS FUNCTION DISPLAY THE RECORD OF THE GIVEN CODE FROM

// THE CANDIDATE FILE (CANDIDATE.DAT)

//**********************************************************

void vote :: display_candidate_record(int tcode)

{ candidate_record cr;

fstream file ;

file.open("CANDIDATE.DAT", ios::in|ios::binary) ;

file.seekg(0,ios::beg) ;

while (file.read((char *)&cr, sizeof(candidate_record)))

{

if (cr.candidate_namecode == tcode)

{

gotoxy(5,3) ;

cout <<"Name Code : "<<cr.candidate_namecode ;

gotoxy(5,4) ;

cout <<"Name : "<<cr.candidate_name ;

gotoxy(5,5) ;

cout <<"Party Name : "<<cr.partyname ;

gotoxy(5,6) ;

cout <<"Party Sign : "<<cr.partysign ;

gotoxy(5,7) ;

cout <<"Revenue : "<<cr.revenue ;

gotoxy(5,8) ;

cout <<"Age : "<<cr.age ;

gotoxy(5,9) ;

cout <<"Area : "<<cr.area ;

break ;

}

}

file.close() ;

}

//**********************************************************

// THIS FUNCTION ADD RECORDS IN THE CANDIDATE FILE (CANDIDATE.DAT)

//**********************************************************

void vote :: add_candidate_name(void)

{

candidate_record cr;

int tcode, valid ;

char ch;

int num_candidates;

tcode = last_candidate_code(num_candidates) ;

tcode++ ;

do

{

clrscr() ;

gotoxy(71,2) ;

cout <<"<0>=Exit" ;

gotoxy(27,3) ;

cout <<" ADD NAME TO THE CANDIDATE LIST" ;

gotoxy(26,4) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(5,6) ;

cout <<"Name Code : " <<tcode ;

gotoxy(5,8) ;

cout <<"Name : " ;

gotoxy(5,10) ;

cout <<"Party Name : " ;

gotoxy(5,12) ;

cout <<"Party Sign : " ;

gotoxy(5,14) ;

cout <<"Summary : " ;

do

{

valid = 1 ;

gotoxy(1,8) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(3,25) ;

cout <<"ENTER NAME TO ADD IN THE CANDIDATE LIST" ;

gotoxy(5,8) ;

cout <<"Name : " ;

gets(cr.candidate_name) ;

strupr(cr.candidate_name) ;

if (cr.candidate_name[0] == '0')

return ;

if ((strlen(cr.candidate_name) < 1) || (strlen(cr.candidate_name) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

}while (!valid) ;

do

{

valid = 1 ;

gotoxy(1,10) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,25) ;

cout <<"ENTER PARTY NAME TO ADD IN THE LIST" ;

gotoxy(5,10) ;

cout <<"Party Name : " ;

gets(cr.partyname) ;

strupr(cr.partyname);

if (cr.partyname[0] == '0')

return ;

if ((strlen(cr.partyname) < 1) || (strlen(cr.partyname) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

} while (!valid) ;

do

{

valid = 1 ;

gotoxy(1,12) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,25) ;

cout <<"ENTER PARTY SIGN TO ADD IN THE MENU" ;

gotoxy(5,12) ;

cout <<"Party Sign : " ;

gets(cr.partysign) ;

strupr(cr.partysign);

if (cr.partysign[0] == '0')

return ;

if ((strlen(cr.partysign) < 1) ||(strlen(cr.partysign) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

} while (!valid) ;

do

{

valid = 1;

gotoxy(1,14) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,25) ;

cout <<"ENTER SUMMARY OF THE CANDIDATE" ;

gotoxy(5,14) ;

cout <<"SUMMARY AS FOLLOWS " ;

getch();

// gets(cr.summary) ;

strupr(cr.summary);

if (cr.summary[0] == '0')

return ;

if ((strlen(cr.summary) < 1) ||(strlen(cr.summary) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

} while (!valid) ;

do

{

valid = 1;

gotoxy(1,16) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,25) ;

cout <<"ENTER REVENUE OF THE CANDIDATE" ;

gotoxy(5,16) ;

cout <<"Revenue : " ;

gets(cr.revenue) ;

strupr(cr.revenue);

if (cr.revenue[0] == '0')

return ;

if ((strlen(cr.revenue) < 1) ||(strlen(cr.revenue) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

} while (!valid) ;

do

{

valid = 1;

gotoxy(1,18) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,25) ;

cout <<"ENTER AGE OF THE CANDIDATE" ;

gotoxy(5,18) ;

cout <<"Age : " ;

gets(cr.age) ;

strupr(cr.age);

if (cr.age[0] == '0')

return ;

if ((strlen(cr.age) < 1) ||(strlen(cr.age) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

} while (!valid) ;

do

{

valid = 1;

gotoxy(1,20) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,25) ;

cout <<"ENTER AREA OF THE CANDIDATE" ;

gotoxy(5,20) ;

cout <<"Area : " ;

gets(cr.area) ;

strupr(cr.area);

if (cr.area[0] == '0')

return ;

if ((strlen(cr.area) < 1) ||(strlen(cr.area) > 50))

{

valid = 0 ;

gotoxy(3,24) ;

cout <<" Range = A.....Z" ;

getch() ;

}

} while (!valid) ;

do

{

gotoxy(1,15) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,28) ;

cout <<"Do you want to save this record (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

} while (ch != 'N' && ch != 'Y') ;

if (ch == 'Y')

{

cr.candidate_namecode = tcode ;

fstream file ;

file.open("CANDIDATE.DAT", ios::out | ios::app | ios::binary) ;

file.write((char *)&cr, sizeof(candidate_record)) ;

file.close() ;

tcode++ ;

}

do

{

gotoxy(1,17) ; clreol() ;

gotoxy(1,24) ; clreol() ;

gotoxy(1,25) ; clreol() ;

gotoxy(5,30) ;

cout <<"Do you want to add more records (y/n) : " ;

ch = getche() ;

ch = toupper(ch) ;

} while (ch != 'N' && ch != 'Y') ;

} while (ch == 'Y') ;

}

//**********************************************************

// THIS FUNCTION DISPLAY THE LIST OF THE NAMES OF CANDIDATES

//**********************************************************

void vote :: list_of_candidate_names(void)

{

clrscr() ;

candidate_record cr;

fstream file ;

file.open("CANDIDATE.DAT", ios::in|ios::binary) ;

file.seekg(0) ;

int row = 6 , found = 0 , pageno = 1 ;

gotoxy(30,2) ;

cout <<"LIST OF NAMES OF CANDIDATES" ;

gotoxy(29,3) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

gotoxy(3,4) ;

cout <<"NAME CODE NAME PARTY NAME PARTY SIGN REVENUE AGE AREA";

gotoxy(2,5) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

while (file.read((char *)&cr, sizeof(candidate_record)))

{

delay(20) ;

found = 1 ;

gotoxy(5,row) ;

cout <<cr.candidate_namecode ;

gotoxy(14,row) ;

cout <<cr.candidate_name ;

gotoxy(31,row) ;

cout <<cr.partyname ;

gotoxy(45,row) ;

cout <<cr.partysign ;

gotoxy(58,row) ;

cout <<cr.revenue ;

gotoxy(69,row) ;

cout <<cr.age ;

gotoxy(75,row) ;

cout <<cr.area ;

if ( row == 22 )

{

row = 5 ;

gotoxy(66,1) ;

cout <<"Page no. : " <<pageno ;

gotoxy(66,2) ;

cout <<"===============" ;

pageno++ ;

gotoxy(1,25) ;

cout <<"Press any key to continue..." ;

getche() ;

clrscr() ;

gotoxy(3,4) ;

cout << "NAME CODE NAME PARTY NAME PARTY SIGN REVENUE AGE AREA" ;

gotoxy(2,5) ;

cout <<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;

}

else

row++ ;

}

if ( !found )

{

gotoxy(5,10) ;

cout <<"Records not found " ;

}

gotoxy(66,1) ;

cout <<"Page no. : " <<pageno ;

gotoxy(66,2) ;

cout <<"===============" ;

gotoxy(1,20) ;

cout <<"Press any key to continue..." ;

getche() ;

file.close () ;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote