SHARE
TWEET

Untitled

a guest Sep 21st, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11.     ifstream inData;
  12.     ofstream outData;
  13.  
  14.     double currentPay1, currentPay2, currentPay3;
  15.     double increasePercentage1, increasePercentage2, increasePercentage3;
  16.     double payIncrease1, payIncrease2, payIncrease3;
  17.     double updatedSalary1, updatedSalary2, updatedSalary3;
  18.  
  19.     string firstName1, firstName2, firstName3;
  20.     string lastName1, lastName2, lastName3;
  21.  
  22.     inData.open("Ch3_Ex6Data.txt");
  23.     outData.open("Ch3_Ex5Output.dat");
  24.  
  25.     outData << setprecision(2);
  26.  
  27.     inData >> lastName1 >> firstName1 >> currentPay1 >> increasePercentage1;
  28.     inData >> lastName2 >> firstName2 >> currentPay2 >> increasePercentage2;
  29.     inData >> lastName3 >> firstName3 >> currentPay3 >> increasePercentage3;
  30.  
  31.     cout << "Processing Data." << endl;
  32.  
  33.     payIncrease1 = currentPay1 * (increasePercentage1 / 100);
  34.     updatedSalary1 = currentPay1 + payIncrease1;
  35.  
  36.     payIncrease2 = currentPay2 * (increasePercentage2 / 100);
  37.     updatedSalary2 = currentPay2 + payIncrease2;
  38.  
  39.     payIncrease3 = currentPay3 * (increasePercentage3 / 100);
  40.     updatedSalary3 = currentPay3 + payIncrease3;
  41.  
  42.     outData << fixed;
  43.     outData << firstName1 << " " << lastName1 << " " << updatedSalary1 << endl;
  44.     outData << firstName2 << " " << lastName2 << " " << updatedSalary2 << endl;
  45.     outData << firstName3 << " " << lastName3 << " " << updatedSalary3 << endl;
  46.  
  47.     inData.close();
  48.     outData.close();
  49.  
  50.     return 0;
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top