Como crear archivos de texto en C++ | El Informatico

in #programacion6 years ago

encabezado.png


Como crear archivos de texto en c++

Hola gente como estan estoy devuelta por aka con un nuevo tutorial y code, sobre como crear archivos de texto en c++, usando la libreria (fstream) que incluye salida y entrada de datos.

Aqui les dejo el codigo:

#include <iostream>       
#include <fstream>            
#include<stdlib.h>             

using namespace std;


int main()
{
     char cadena [30];               
int x=0;                             
   ofstream tutorial("tutorial.txt");
   tutorial <<"no entieno "<<endl;  
    tutorial <<"Que hago "<<endl ;  
   tutorial.close();  
   
                      
   
   tutorial.close();
   
  ifstream canal("tutorial.txt");            
  canal.getline(cadena,30);                   
  
  while (x<20)        
  {
  cout<<cadena[x];
  x++;
   }
return 0;
}




Si necesitan un video para la explicacion del codigo pueden verlo aqui;


Bueno esto ha sido todo por hoy espero les haya ayudado, se les quiere



Informatica.jpeg

Sort:  

Congratulations @vyvyrruz! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 10 upvotes. Your next target is to reach 50 upvotes.
You made more than 10 comments. Your next target is to reach 50 comments.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemFest3 and SteemitBoard - Meet the Steemians Contest

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @vyvyrruz! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got a First Reply

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

The Meet the Steemians Contest is over - Results are coming soon ...

Support SteemitBoard's project! Vote for its witness and get one more award!