Original Post
Is there any way to do this on Windows? I am writing a cryptogram generator, and would like the user to be able to print the cryptogram out automatically. Thanks for any help!
#include <iostream>#include <fstream>#include <iterator>#include <algorithm>using namespace std;int main ( void ) { ifstream file( "filename.txt" ); istream_iterator< char > begin( file ) , end; ostream_iterator< char > output( cout ); copy( begin , end , output );}#include <iostream>#include <fstream>#include <string>#include <vector>using namespace std;int main ( void ) { ifstream file( "filename.txt" ); //opens a file... vector< string > lines; //we'll store lines in here... while ( file ) { //while the file is good... string line; getline( file , line ); //get a line from file and put it into line if ( ! line.empty() ) lines.push_back( line ); //if the line isn't empty, add it to lines. } cout << lines[ rand() % lines.size() ] << endl; //print a random line.}Quote:
Original post by DvDmanDT
Hmm.. Are you sure the OP didn't mean print as in use printer?
Quote:
Even if he didn't can anyone please post a link or a keyword to search for, to find info on printing? In windows that is..
Quote:
Original post by DvDmanDT
Hmm.. Are you sure the OP didn't mean print as in use printer?
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more