can files be used for multiple value storage for a variable?

i want the user to be able to input a number of values into the following variables, i.e., "no1", "str" and "age". will creating the file suffice or do i need to use arrays for them along with the file?
the following code is only a part of my real code and this is the part where i need help. it is in a function called CreRe()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 :
 :
 :
   afile.open("file.dat", std::ios::out | std::ios::in);
    std::cout<<"\n CREATE RECORDS \n \n Enter Record Number: ";
    std::cin>>no1;
    afile<<no1;
    std::cout<<"\n Enter name: ";
    std::cin>>str;
    afile<<str;
    std::cout<<no1<<str;
    std::cout<<"\n Enter age: ";
    std::cin>>age;
    afile<<age;
 :
 :
 :
Last edited on
Topic archived. No new replies allowed.