1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| #include<iostream>
#include<fstream>
#include<vector>
#include<string>
using namespace std;
int main()
{
std::string donnees;
std::ifstream fichier("fichier.txt");
std::vector<std::vector<char> > MonTableau;
while(std::getline(fichier, donnees))
{
std::vector<char> row;
for(int &x : donnees)
{
if(x != ' ')
row.push_back(x);
}
MonTableau.push_back(row);
}
for(std::vector<char> &row : MonTableau)
{
for(int &x : row)
std::cout<<x<< ' ';
std::cout<< '\n';
}
return 0;
} |
Partager