| | |
Code that stores and retrieves.
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
hi every body try out this code it can store your info and then retriaeve it ant any time you wish.
They are two codes each wrote separatly so first write the outputting code and run it.
Then write the inputting code and also run it
have fun:lol:
They are two codes each wrote separatly so first write the outputting code and run it.
Then write the inputting code and also run it
have fun:lol:
//code for out putting on the file private.dat. #include<iostream.h> #include<fstream.h> #include<stdlib.h> void main() { ofstream my_record("private.dat",ios::out); if(!my_record) { cerr<<"the fail can not be created"<<endl; exit(1); } int age; char name[10]; int registration; while(cin>>age>>name>>registration) { my_record<<age<<' '<<name<<' '<<registration<<endl; cout<<"---"<<endl; } //code for in putting on the file private.dat. #include<iostream.h> #include<fstream.h> #include<stdlib.h> void display(int,const char*const,int); void main() { ifstream my_record("private.dat",ios::in); if(!my_record) { cerr<<"the fail can not be found"<<endl; exit(1); } int age; char name[10]; int registration; cout<<"AGE\t NAME \tREGESTRATION"<<endl; while(my_recod>>age>>name>>registration) diplay(age,name,registration); } void display(int d,const char*const t, int y) { cout<<d<<'\t'<<'\t'<<t<<'\t'<<'t'<<y<<endl; }
Similar Threads
- SQL database stores data twice (ASP.NET)
- How a web browser retrieves a web page? (Domains and DNS)
- Database Design help for stores (Database Design)
- Online Computer stores? (Geeks' Lounge)
| Thread Tools | Search this Thread |
Tag cloud for C
#include * append array arrays asterisks binarysearch calculate changingto char character cm command copyimagefile creafecopyofanytypeoffileinc database directory dynamic execv feet fgets file floatingpointvalidation fork forloop framework function functions getlogicaldrivestrin givemetehcodez grade graphics gtkwinlinux hacking histogram homework ide include incrementoperators input intmain() iso kernel keyboard kilometer lazy license linked linkedlist linux list lists looping loopinsideloop. lowest matrix microsoft mqqueue mysql number oddnumber odf openwebfoundation overwrite pause pdf performance pointer pointers posix probleminc process program programming radix recursion recv recvblocked research reversing scripting segmentationfault sequential single socket socketprogramming spoonfeeding standard string student systemcall testing threads turboc unix urboc user variable whythiscodecausesegmentationfault windowsapi




