Preview:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

int main() {
    ifstream fichierIN("res.txt");
    ofstream fichierOUT("salaire.txt");
    string nom;
    int th, nbheure;
    double salaire;

    for (int i = 1; i <= 3; i++) {
        fichierIN >> nom >> th >> nbheure;
        
        if (nbheure > 40) {
            salaire = (40 * th) + ((nbheure - 40) * 1.5 * th);
        }
        else {
            salaire = nbheure * th;
        }
        
        fichierOUT << " " << setw(10) << left << nom << salaire << endl;
    }

    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter