why cant it work properly???
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
ofstream out;//create output stream
int acc_num[10];
for(int x=0;x<10;x++)
acc_num[x] = rand()%10; //generate account number
char acc_file[600];
for(int x=0;x<10;x++)
acc_file[x] = acc_num[x] + '0';
out.open(acc_file, ios::out);//create & open output file
out << "PACKAGE ID: ";
for(int x=0;x<10;x++)
out << acc_num[x];
out << endl;
//------------------------------ENTER DETAILS-------------------------
string sname, saddress, scity, sstate, weight;
int szipcode;
cout << "ENTER WEIGHT OF PACKAGE(Kg): ";
cin >> weight;
out << "WEIGHT OF PACKAGE: " << weight << endl;
cin.ignore();
cout << "ENTER SENDER'S NAME: ";
getline(cin, sname);
out << "SENDER'S NAME: " << sname << endl;
cin.ignore();
cout << "ENTER SENDER'S ADDRESS: ";
getline(cin, saddress);
out << "SENDER'S ADDRESS: " << saddress << endl;
cin.ignore();
cout << "ENTER SENDER'S CITY: ";
getline(cin, scity);
out << "SENDER'S CITY: " << scity << endl;
cin.ignore();
cout << "ENTER SENDER'S STATE: ";
getline(cin, sstate);
out << "SENDER'S STATE: " << sstate << endl;
cin.ignore();
cout << "ENTER SENDER'S ZIP CODE: ";
cin >> szipcode;
out << "SENDER'S ZIP CODE: " << szipcode << endl;
system("pause");
}