>plz tell smething more abt my problm.
How about we skip the part where I call your code crap with examples and I just give you a better version:
#include <iostream>
#include <fstream>
using namespace std;
struct computerspec {
int ram;
int hdisk;
}compuspec;
int main()
{
char ch;
ofstream out("computerspec.txt");
do {
//prompt the user to enter RAM capacity
cout<<"Enter the RAM capacity"<<endl;
cin>>compuspec.ram;
cout<<endl;
//prompt the user to enter Hard Disk capacity
cout<<"Enter the Hard Disk capacity"<<endl;
cin>>compuspec.hdisk;
cout<<endl;
out<<"ComputerSpec attributes/Data members\n";
out<<"RAM"<<"\t"<<"Hard disk"<<endl;
out<<compuspec.ram<<"\t"<<compuspec.hdisk<<endl;
cout<<"Press 'y' if u wanna continue"<<endl;
while (cin.get(ch) && ch != '\n')
;
cin.get(ch);
cout<<endl;
} while(ch=='y'||ch=='Y');
out.close();
ifstream in("computerspec.txt");
while(in.get(ch))
cout<<ch;
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401