Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream.h>
- #include<conio.h>
- #include<stdio.h>
- #include<ctype.h>
- class a
- {
- private:
- char name[10];
- int rno;
- int s;
- public:
- void input()
- {
- cout<<"enter name";
- gets(name);
- cout<<"enter rollno";
- cin>>rno;
- }
- void display()
- {
- puts(name);
- cout<<rno;
- }
- void search()
- { cout<<"enter the roll no. to be searched:";
- cin>>s;
- if(s==rno)
- {
- cout<<"roll no found";
- }
- else
- {
- cout<<"not found";
- }
- }
- };
- void main()
- { clrscr();
- a obj;
- //obj.input();
- //obj.display();
- //
- obj.search();
- remove("file.txt");
- ofstream ofile;
- ofile.open("file.txt",ios::app);
- ofile.write((char*)&obj,sizeof(obj));
- ofile.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement