how do i output solution in array form into a file where it can then be copied.

Recommended Answers

All 2 Replies

use a loop to output contents to the file.

int numbers[10] = {1,2,3,4,5,6,7,8,9,10};
ofstream myFile("myFile.txt",ios::app);
for(int i=0;i<10;i++)
{
myFile<<numbers[i]<<endl;
}
myFile.Close();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.