please how do I print a hard copy of the content of a c++ console?

I'm not sure what you mean by a "C++" console. However, if you mean what you see in the console after running your program then it depends on your system.

If you have access to the source code of the program then you can replace all the output streams ( cout and cerr ) with output to a file stream. Your text will now longer appear on screen but in a file.

That is exactly what I mean. But how can I do that? I.e how can I print to a file stream?

hello, i need your help please!...

this is the problems that my head are aching so much.

1. ask user to enter integer. determine whether it is prime or composite. the program will only terminate if he/she already input primes.

note: 1&0 is neither prime nor composite.

2. ask user to enter a string cout how many 0,1,2,3.....9 are there in the string.
display all the data into the file. the program must be able to repeat if the user wants to.

please give a answers or a formulas/clues...

That is exactly what I mean. But how can I do that? I.e how can I print to a file stream?

Example of printing to the console:

#include <iostream>
int main () {
   std::cout << "To the console" << std::endl;
   return 0;
}

Example of writing to file:

#include <fstream>
int main () {
   std::fstream stream ("the.file", std::fstream::out);
   stream << "To the file" << std::endl;
   stream.close();
   return 0;
}
This article has been dead for over six months. Start a new discussion instead.