codice:#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream rd; ofstream wr; rd.open("tutte_righe.txt"); wr.open("riga_scelta.txt"); string line; int contatore = 0; int ferma = 0; while(!rd.eof()) { contatore++; } ferma = rand() % contatore; rd.close(); rd.open("tutte_righe.txt"); contatore = 0; while(!rd.eof()) { if(ferma == contatore) wr<< line; break; } else { contatore++; } rd.close(); wr.close(); return 0; }