Im trying to learn working with text files and I been able to make a program adding text to a text file. However I have no clue how to make it so I'm able to add numbers to the text file. I want the program first ask for the name then for the age.
Like this:
How many names do you want to enter: 2
Enter name: Adam
Enter Age: 43
Enter name: Mark
Enter Age: 37

This is I have so far. Appreciating any help.

char vekt[50][30];
int antal;
cout<<"How many names do you want to enter:  ";
    for(int i=0;i<antal;i++)
			cout <<" Enter name: ";

ofstream utskrift("data.txt",ios::app);
			cout<<"could not find file"<<endl;
for(int i=0;i<antal;i++)

So whats wrong with it? Does it not work or are you getting a compiler error?

Um... How do you expect to add a number to the file if you never read a number? I don't see anything related to the "Enter Age: " prompt...

Once you add the proper input statements, the rest is basically the same as for the name.