Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 12, 2020 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/647a1c1d03590c12fd3b3ad819344593 to your computer and use it in GitHub Desktop.
Save parzibyte/647a1c1d03590c12fd3b3ad819344593 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
using namespace std;
/*
https://parzibyte.me/blog
*/
int main() {
string nombreArchivo = "videojuegos.txt";
ofstream archivo;
// Abrimos el archivo
archivo.open(nombreArchivo.c_str(), fstream::out);
// Y le escribimos redirigiendo
archivo << "cuph";
archivo << "ead";
// No olvidemos saltos de línea
archivo << endl;
// Podemos escribir más
archivo << "doom eternal" << endl;
archivo << "doom 2016" << endl;
archivo << "resident evil 2" << endl;
// Finalmente lo cerramos
archivo.close();
cout << "Escrito correctamente";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment