Hey all , I started to learn C++ recently and I wud need some help on something.
Here is my file.txt:
Code:
Allemagne 357021 83251851 Euro
Australie 7686850 19546792 Dollar_australien
Belgique 30510 10274595 Euro
Egypte 1001450 70712345 Livre_egyptienne
------------------------------------------------------------------------------------------------------
Here is my code:
Code:
int main()
{
string filename,country,money;
int population,sup;
cout << "Wuts the name of the file to read ?" << endl;
cin >> filename;
ifstream reading;
reading.open(filename.c_str());
if(reading.fail()) {
cerr << "Error cudnt open the file" << filename
<< endl;
exit(EXIT_FAILURE);
}
while(reading >> country >> sup>> population>> money){
cout << country<< " "<<sup<< " "<< population << " "<<money<< " "<< endl;
}
reading.close();
------------------------------------------------------------------------------------------------------
Here is my question:
If I want the text after i read it to be in the same format as the original (the same alignment) how can I do? I know the command setw() but it only do for example ___country ______money ... Hope someone can answer