everything well; here I am writing of Brazil and using an electronic translator for posting then please in English doesn't repair English
my problem is the following:
program should open the file, to read and to store the present strings in the file and to show in the screen, later to order the strings and to show again in the screen
my problem is the following:
program should open the file, to read and to store the present strings in the file and to show in the screen, later to order the strings and to show again in the screen
the part of to order and to show not in the screen this working
#include <fstream>
#include <vector>
#include <string>
# include <algorithm>
#include <iostream>
using namespace std;
int main() {
string nomearq, s;
vector<string> vet,;
cout << " Name of the file: ";
cin >> nomearq;
ifstream arq(nomearq.c_str());
while(getline(arq,s)) vet.push_back(s);
for(int i=0; i<vet.size();i++) cout<< "Strings read in the file :\n "<<vet[i]<<endl;
sort(vet.begin(),vet.end());
for(int i=0; i<vet.size();++i) cout<< "orderly vector :\n "<<vet[i]<<endl;
with relationship to the file vc is enough it creates one.txt in the same paste of the.exe of the program
thank you for the attention
Yes, but did it exists before the program ran? If it didn't, then when the program tries to open it, it creates an empty file, which of course has no lines, so there's nothing to sort or display.