Still can not write or read from save file
I am wondering if it has anything to do with the program that saves the file. Here is the code for that program
[CODE] #include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<fstream>
#include<algorithm>
int getpin(int & );
int i;
using namespace std;
int main()
{
//declare variables
string clerkId ="";
int ssn =0;
string name ="";
string address ="";
string city ="";
string state ="";
int zip =0;
int pin = 0;
int visa = 0;
//enter input itesm to a file
ofstream outfile;
outfile.open("WACKOFILE.dat", ios:ut);
if(outfile.is_open())
{
//Clerk is to enter ID for login Information
cout<<"Enter ClerkId: ";
getline(cin, clerkId);
//This will Loop Through Program and then Exit Loop
//Once Clerk-ID id Null
while(clerkId != "xx")
{
//Get Name Address City State Zip Social Security Number
cout <<"Enter SSN: ";
cin>>ssn;
cin.ignore(1);
cout <<"Enter Name: ";
getline(cin, name);
cout <<"Enter Address: ";
getline(cin, address);
cout <<"Enter City: ";
getline(cin, city);
cout <<"Enter State: ";
getline(cin, state);
cout <<"Enter Zip: ";
cin>>zip;
pin = getpin(visa);
cin.ignore(1);
cin.ignore(1);
// Format Title Lines for Name, Address, City, State, and Zip
cout<<setw(25)<<left<<"Name"<<" "<<setw(25)<<left<<"Address"<<" "
<<setw(16)<<left<<"City"<<" "<<setw(2)<<"ST"<<" "<<setw(5)<<left<<"Zip"<<endl;
//Format Display Output
cout<<setw(25)<<left<<name<<" "<<setw(25)<<left<<address<<" "
<<setw(16)<<left<<city<<" "<<setw(2)<<state<<" "<<setw(5)<<setfill('0')<<right<<zip<<endl;
cout<<setw(2)<<left<<"ClerkID"<<" "<<setw(9)<<setfill(' ')<<left<<"SSN"<<endl;
cout<<setw(2)<<left<<clerkId<<" "<<setw(9)<<left<<ssn<<endl;
cout<<"Enter ClerkId: ";
getline(cin, clerkId);
}
}
else
{cout<<"File not Open"<<endl;}
outfile.close();
return 0;
}
int getpin(int & visa)
{
srand(time(NULL));
visa = 10000 + rand()%(99999-10000 + 1);
return 10000 + rand()%(9999-1000 + 1);
}
[CODE]
Any and all help please, I am going nuts with this one.