GoConqr has a new look! Let us know what you think.

Module 6 of 10 · Text

Exemplu

Alexandru Țecu

#include<iostream>

#include<fstream>

using namespace std;

int main() {

int v[100],i=0,j=0; 

fstream f("fis.in", ios::in); //s-a deschis fisierul pentru citire

//o altă varianta ar fi fost: ifstream f("fis.in");

while(!f.eof()) // cât timp nu s-a ajuns la sfârşitul fisierului text

{ i++;

f>>v[i]; //se citeste din fisier caracter cu caracter

j++;}

f.close(); // se închide fisierul 

fstream h("fis.out",ios::app);//se deschide fisierul pentru adaugare

for(i=1;i<j;i++

   h<<v[i];se scrie(se adauga) din vector in fisier

h.close();//se inchide fisierul

}

 

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?