ifstream readFile;
ofstream genFile;
readFile.open("data.txt");
if(readFile.fail())
{
cout<<"Required File data.txt does not exist"<<endl<<"No existing records was found. Program will now generate file automatically"<<endl<<"Press ENTER key to proceed to main menu"<<endl;
readFile.close();
genFile.open("data.txt");
}
else if(readFile.good())
{
cout<<"File data.txt exists. Press ENTER key to proceed to the main menu"<<endl;
}
readFile.close();
genFile.close();
menu();
void about()
{
ClearScreen();
cout<<"About the Program"<<endl<<endl;
cout<<"Voter's Registration Program"<<endl;
cout<<"This program allows its user to facilitate a computer orriented Voter's Registration."<<endl;
cout<<"It implements the usage of Structures and heavily relies on File Streams to"<<endl<<" save, access, delete and search data";
// cout<<data;
writeFile<<data;
writeFile.close();
readFile.close();
cout<<"\n\nVoter was successfully registered!!";
menu();
}
else if(use.age<18)
{
cin.ignore();
cout<<"Person being resitered is not qualified for registration!!"<<endl<<"Minimum Age not met";
menu();
void remove()
{
ofstream genFile("data.txt");
char name[20],ch;
cout<<"Enter the name of the person whose record you wanna delete : "<<endl;
cin>>name;
ofstream outfile;
//creates a temporary file of stream outfile
outfile.open("delete.TXT",ios::out);
genFile.seekg(0L,ios::beg);
//position get pointer at the beginning of the file