/* numeroi1.cpp */ // Ohjelmalla tulostetaan tiedosto koe.txt numeroituna ja katkottuna/ vl96 #include #include #include #include using namespace std; int main(void) { string jono,nimi("koe.txt"); int rivinro = 1; ifstream f(nimi.c_str()); if ( !f ) { cout << "Tiedosto " << nimi << " ei aukea" << endl; return 1; } cout.fill('0'); while ( getline(f,jono) ) { if ( jono.length() > 40 ) jono.erase(40); // katkaisu cout << "/* " << setw(2) << rivinro << " */ " << jono << endl; rivinro++; } return 0; }