I would like to output a file which is readable like database concept. What I expect is:
Name[10] ContactNo[15] GENDER[10]
====================================
Johnny +60123456789 MALE
Emily +69876543210 FEMALE
Jason +61535648979 MALE
And i attempt to do this with:
char name[10],contact[15],gender[10];
//user input here//
ofstream myfile("contact.txt");
myfile>>name>>contact>>gender;
but all string in output file is concatenate without any space. Any idea that i can do that? I try to do this in order for when i read data from file with exactly width and put them into variable, is it a wrong concept? Or any suggestion?