TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shresthi Jaiswal
NA
900
72.7k
Identifier add_voter_name can not have a type qualifier
Dec 27 2016 9:57 AM
Getting this error in code"
Identifier add_voter_name can not have a type qualifier
Here's my code:
void vote :: add_voter_name(void)
{
clrscr();
voter_record vr;
fstream file;
int add_voter_name ;
int vcode, valid ;
char ch;
int num_voters;
vcode = last_voter_code(num_voters) ;
vcode++ ;
do
{
clrscr() ;
cout <<"<0>=Exit" ;
cout <<" ADD NAME TO THE VOTER LIST" ;
cout <<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" ;
cout <<"Name Code : " <<vcode ;
cout <<"Name: " ;
cout <<"Age: " ;
cout <<"Gender: " ;
do
{
valid = 1 ;
clreol() ;
clreol() ;
clreol() ;
cout <<"ENTER NAME OF THE VOTER TO ADD IN THE LIST" ;
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 ;
cout <<"\7 Range = A...Z" ;
getch() ;
}
} while (!valid) ;
do
{
valid = 1 ;
clreol() ;
clreol() ;
clreol() ;
cout <<"ENTER AGE OF VOTER TO ADD IN THE LIST" ;
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 ;
cout <<"\7 Range = 18...100" ;
getch() ;
}
if (atoi(vr.age) < 18)
{
valid = 0;
cout <<"\7 Voter's age is less than 18";
getch();
}
} while (!valid) ;
do
{
valid = 1 ;
clreol() ;
clreol() ;
clreol() ;
cout <<"ENTER GENDER OF VOTER TO ADD IN THE MENU" ;
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 ;
cout <<"\7 Range = M/F" ;
getch() ;
}
} while (!valid) ;
do
{
clreol() ;
clreol() ;
clreol() ;
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
{
clreol() ;
clreol() ;
clreol() ;
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') ;
}
Any help or suggestion will be very helpful.
Kindly, help ASAP.
Reply
Answers (
0
)
Creating a chat app
how to get input