#include #include #include #include using namespace std; int main(int argc, char *argv[]) { ofstream outStream ("result.txt"); outStream << "Results:" << endl; string current_text; int current_int; ifstream inStream ("example.txt"); if(inStream.is_open()) { // Einlesen kann losgehen... while(!inStream.eof()) { getline(inStream, current_text); cout << current_text << endl; // Convert to int istringstream(current_text) >> current_int; outStream << 2 * current_int << endl; } /* // Geht auch so... while (inStream >> current_text) { cout << current_text << endl; // Convert to int istringstream(current_text) >> current_int; outStream << 2 * current_int << endl; } */ } else { cout << "Error while opening file!" << endl; } outStream.close(); system("PAUSE"); return EXIT_SUCCESS; }