optical shop simple software

hey everyone!
I am making simple optical shop software in which we have have to enter name,age and customers number of specs.
But i am not able to save record in file.
So please anyone help.
Use the header file fstream.h.It actually helps you store the data in the form of file by creating an input /output file objects.
http://www.cplusplus.com/doc/tutorial/files/

http://www.daniweb.com/software-development/cpp/threads/6542/fstream-tutorial
I have tried. This is the program:
#include<conio.h>
#include<string>
#include<time.h>
using namespace std;
main()
{
string name;
char date[9];
_strdate(date);
int age;
float rsd,rcd,rad,rvd;
float rsn,rcn,ran,rvn;
cout<<"Name:";
getline(cin,name);
name += ".txt";
ofstream SaveFile( name.c_str() );
SaveFile<<"Name:"<<name;
cout<<"Date:"<<date;
SaveFile<<"\nDate:"<<date;
cout<<"\nAge:";
cin>>age;
SaveFile<<"\nAge:"<<age;
cout<<"R.E SPH DIST:";
cin>>rsd;
cout<<"R.E CYL DIST:";
cin>>rcd;
cout<<"R.E. AXIS DIST:";
cin>>rad;
cout<<"R.E. VN DIST:";
cin>>rvd;
cout<<"R.E SPH NEAR:";
cin>>rsn;
cout<<"R.E. CYL NEAR:";
cin>>rcn;
cout<<"R.E AXIS NEAR:";
cin>>ran;
cout<<"R.E. VN NEAR:";
cin>>rvn;
cout<<"\n*****************R.E.********************";
SaveFile<<"\n*****************R.E.********************";
cout<<"\n******SPH*****CYL*******AXIS******VN*****";
SaveFile<<"\n******SPH*****CYL*******AXIS******VN*****";
cout<<"\nDIST- "<<rsd<<" "<<rcd<<" "<<rad<<" "<<rvd;
SaveFile<<"\nDIST- "<<rsd<<" "<<rcd<<" "<<rad<<" "<<rvd;
cout<<"\nNEAR- "<<rsn<<" "<<rcn<<" "<<ran<<" "<<rvn;
SaveFile<<"\nNEAR- "<<rsn<<" "<<rcn<<" "<<ran<<" "<<rvn;
cout<<"\n*****************************************";
SaveFile<<"\n*****************************************";
SaveFile.close();
return 0;
}

now only problem is that whenever i type name it saves with that name but inside also it says name with extension ".txt". how to remove that .txt
Topic archived. No new replies allowed.