@lastchance
Actually he did not. As you may know. You can only put a variable or anything you want into a text file one at a time, which means, if you have more variables which I am entering with the cin as a z for example ( 12,2,3,45) it only puts one number into the file if you are doing this without an array. But i need them all in the file.. maybe i wasn't clear enough sorry
No Darkiyee, you bother to read the link that he gave you. The examples in that tutorial do not use an array.
Open a file before your loop. One line of code - see the tutorial example for opening files.
Every time you go round that loop you read one more z value. As soon as you have that z value - on the next line for example - you can write it to the file. One line of code - see the tutorial.
When you finish looping you can close the file if you want to. One line of code - see the tutorial.
By then your file will have all the z values you entered while you were looping
I haven't a clue what arrays have got to do with it.