exo5

PHOTO EMBED

Tue Sep 19 2023 21:18:59 GMT+0000 (Coordinated Universal Time)

Saved by @Mehdiiiiiii7

#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;
}
content_copyCOPY