Advertisement
gallopelado

FICHEROS.Ejercicio3

Mar 7th, 2014
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. //3. ejer3.cpp – Escribir 10 líneas en un archivo.
  2. #include <iostream>
  3. #include <fstream>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     ofstream entrada;//apertura del manejador
  11.     entrada.open("lineas.txt");
  12.     if(entrada.bad())
  13.     {
  14.         cout<<"No se pudo abrir el fichero o esta corrupto";
  15.     }
  16.     else
  17.     {
  18.         for(int i=0;i<10;i++)
  19.         {
  20.  
  21.         entrada<<"Hola mundo"<<endl;
  22.         }
  23.     }
  24.     entrada.close();//Cierra el archivo
  25. }
  26. //Hecho por Juan José González Ramírez
  27. //Correo: juanftp100@gmail.com
  28. //Publicado en https://www.facebook.com/infosur2038
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement