473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Coding help please!!

Kindle Life 123
I have typed in a program that shows two errors like this..
(1) Identifier 'searchfor' cannot have a type qualifier in function club::writeinto()
(2)Declaration missing ; in function club::writeinto()


my program..

//Program to help me #include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<fstream.h>
#include<stdio.h>
#include<string.h>
#include<iostream.h>
class club
{int mno;
char activity[50];
public:
char memname[20];
void enterdata()
{
cout<<"Enter details";
cin>>mno>>memname>>activity;
}
void showdata()
{cout<<mno<<memname<<activity;
}
char*retname()
{
return memname;
}

void writeinto();
void searchfor();
void update();
void del();
void exit()
{
exit();
}

};

void club::writeinto()
{
club c;
{
ofstream fout("project.dat",ios::binary);
{
if (!fout)
{
cout<<"Error";
exit();
}
while(!fout.eof())
{
int N,i;
cout<<"Enter the number of records to be entered";
cin>>N;
{for(i=0;i<N;i++)
c.enterdata();
fout.write((char *)&c,sizeof(c));
}
fout.close();
}}}


void club::searchfor()
{
club c;
{
ifstream fin("project.dat",ios::binary);
if(!fin)
{
cout<<"Error";
}
while(!fin.eof())
{
char name[23];
cout<<"Enter the name";
cin>>name;
fin.read((char*)&c,sizeof(c));
{
if(strcmp(name,c.memname)==0)
c.showdata();
}
fin.close();
}}


void update()
{
club c;
char modname;int match=1;
fstream file("project.dat",ios::out|ios::in|ios::binary);
cout<<"Enter the name to be modified";
cin>>modname;
if(!file)
{
cout<<"Error";
}
while(!file.eof())
{
file.read((char*)&c,sizeof(c))
{ if(modname==c.memname())
{
c.enterdata();
}
file.seekp(-1*sizeof(c),ios::cur)
file.write((char*)&c,sizeof(c));
match=1;
else
match=0;
}}
if(match==0)
cout<<"Sorry,Match not found";
}
file.close();
}

void del()
{ club c;
char del[24];
ofstream fout("temp.dat",ios::binary);
ifstream fin("project.dat",ios::binary);
if(!fin)
{
cout<<"Error";
}
if(!fout)
{
cout<<"Error";
}
while(!fin.eof())
{
while(fin.read(char*)&c,sizeof(c))
{ c.Display();
if(c.returnname()!=del)
fout.write((char*)&c,sizeof(c));
fin.close();
fout.close();
remove("project.dat");
rename("temp.dat","project.dat");
}


//Void main Program


void main()
char user[25],password[25],cnt, option;
club c2;
cout<<"Enter username";
cin>>user;
cout<<"Enter password";
cin>>password;
if(strcmp(user,"student")&&strcmp(password,"1234") ==0)
{
cout<<"Login successful!";
cout<<""<<"Hello! Welcome to the Club page for members"<<""<<'\t';
cout<<""<<"MENU"<<""<<'\t';
cout<<""<< "Choose any option to proceed!"<<"";
do
{
cout<<""<<"1."<<""<<""<<"Add a new record"<<""<<""<<'\t';
cout<<""<<"2."<<""<<""<<"Search for a record"<<""<<""<<'\t';
cout<<""<<"3."<<""<<""<<"Update a record"<<""<<""<<'\t';
cout<<""<<"4."<<""<<""<<"Delete a record"<<""<<""<<'\t';
cout<<""<<"5."<<""<<""<<"Exit"<<""<<""<<'\t';
switch(option)
{
case 1:c2.writeinto();
break;
case 2:c2.searchfor();
break;
case 3:c2.update();
break;
case 4:c2.del();
break;
default:exit(0);
}
cout<<"Do you want to continue";
cin>>cnt;
while(option<4||cnt=="Y")
}
else
{
cout<<"Sorry,try again";
break;
}}


}

There is no void main...
Pls. reply asap


thanks a lot
Sep 16 '18 #1
1 1508
weaknessforcats
9,208 Expert Mod 8TB
Start with simpler code.

Like this:

Expand|Select|Wrap|Line Numbers
  1. class club
  2. {
  3.  
  4. };
  5.  
  6. int main()
  7. {
  8.  
  9.    club c;
  10. }
Get this to compile.

Then add ONE thing. Like a data member or a member function.

Then recompile and get that working.


This way when there's an error it will be in the last code you entered. Rather than fix errors, it's better to keep errors out in the first place.


What you posted has a lot of errors that I can see.
Sep 16 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: James | last post by:
Please help - getting very desperate! Sun, 12 October 2003 05:39 I have PHPDEV 4.2.3 from Firepages.com.au as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as...
4
by: Larry | last post by:
Help Please http://www.angelfire.com/folk/ps197_brooklyn_ny I currently have a main page that has a list of about 50 names. I then have 50 pages that are linked to the main page The...
1
by: SallyBenjamin | last post by:
Hello.. Can anyone help me with this coding. Basically, it needs to have add node, remove node, add edges , remove edges and display the graph But.I have only succedded to add node, add and...
50
by: Konrad Palczynski | last post by:
I am looking for tool to validate conformity to defined coding standard. I have already found Parasoft's C++ Test, but it is quite expensive. Is there any Open Source alternative? I do not need...
0
by: pat | last post by:
CodeCheck Coding Standard's Support As a free service to our customers we offer support in developing "rule-files" for automating corporate coding standards. If you have a coding standard that...
4
mikeinspain
by: mikeinspain | last post by:
I am getting a Fatal Error message as shown below; Fatal error: Call to undefined function: phprequire() in /home/9144/domains/cbweb.co.uk/html/propertyEnquiry.php on line 1 The code behind this...
3
by: sunburst | last post by:
I will include my code below. Is there anyone who can help me sort out this problem please? when i move from my index to the next roll over button links i am unable to keep the background as...
8
by: Bhavesh1978 | last post by:
well i have my mouse working and now im trying to make my exit button working when the mouse clicked onto exit button and it will exit the application here is my coding for the mouse function to...
3
by: Peyman | last post by:
Hello perl programmers. i have the following code in one of my scripts. i dont have any idea about what does most of the code do. i will put some notes regarding which parts i dont undrestand. could...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.