struct patient
{
int ID;
char name[60];
char adress[60];
char age[4];
}patients;
cout<<"your ID"<<endl;
cin>>patients.ID;

i want to make file to every patient , my question how to make file with the ID that every
user will Enter it
please help

#include <fstream>
#include <string>
#include <iostream>
#include <sstream> // To use when converting int to string
using namespace std;

string toStr(int i);

struct patient {
int ID;
char name[60];
char adress[60];
char age[4];
} patients;

int main()
{
cout<<"your ID"<<endl;
cin>>patients.ID;

string filename=toStr(patients.ID)+".txt"; // file name
ostream file(filename.c_str());

// Check file;

file.close();
cin.get();
return 0;
}

string toStr(int i) {
stringstream ss;
string return_val;
ss << i; // read i into ss
ss >> return_val; // write to return_val

return return_val;
}