Using the drop-down menu, please complete the program below so that it will open a text file of Fahrenheit temperatures separated by spaces called “Fahrenheit.txt” for input, process that file temperature by temperature by converting each Fahrenheit temperature into a Celsius temperature through a function called convertCelsiustoFahreinheit(double a_fahrienheit_temp) which converts the Fahrenheit temperature to Celsius and returns it to the main method, which outputs each of these results to an output file called “Celsius.txt”. #include #include #include #include using namespace std;double convertFahrenheitToCelsius(double a_Fahrenheit_Temp){ double answer = (5.0/9.0) * (a_Fahrenheit_Temp – 32.0); return answer;}int main(){ //Declare variables to hold current data double a_celsius_temp; double a_fahrenheit_temp; //Declare input and output file handlers ifstream input_file; ofstream output_file; //Declare vector of double to hold input and output data vector fahrenheit_temps; vector celsius_temps; //Open input file [x1] //Read in first temperature input_file >> a_fahrenheit_temp; //Process the rest of the input file while (!(input_file.eof())) { //Call the function that converts a fahrenheit temperature to a celsius temperature a_celsius_temp = [x2] //Push celsius temperature and fahrenheit temperature into a celsius and fahrenheit temperature vectors, respectively fahrenheit_temps.push_back(a_fahrenheit_temp); celsius_temps.push_back(a_celsius_temp); //Read next temperature from input file [x3] } //Close Input file input_file.close(); //Open Output file output_file.open(“Celsius.txt”, fstream::out); //Write contents of fahrenheit and celsius temperature vectors into output file for (int i = 0; i < celsius_temps.size(); i++) { [x4] } //Close Output file output_file.close(); return 0;}
Blog
Assume all variables are properly declared. The following fo…
Assume all variables are properly declared. The following for loop executes 20 times:for (i = 0; i < 20; i++) cout
Consider the following C++ code: int x = 0; for (int…
Consider the following C++ code: int x = 0; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { x = x + (i * j); } } After this code executes, what is the final value of x? (Hint: Your answer should be entered as an integer value, without quotes, spaces, or symbols!)
Which of the following is/are NOT true about neuroimaging st…
Which of the following is/are NOT true about neuroimaging studies of visual imagery:
You are introduced to a new kind of toy called a blicket. Yo…
You are introduced to a new kind of toy called a blicket. You are shown ten blickets, all of which are red in color. You conclude that all blickets must be red. This is an example of:
The set of all possible states that can be reached in attemp…
The set of all possible states that can be reached in attempting to solve a given problem together make up the:
Devin must determine the probability of flipping a fair coin…
Devin must determine the probability of flipping a fair coin and getting HHTTHT and then judge whether this probability is more, less, or equal to the probability of flipping HHHHHH with the same coin. He knows these are equal probabilities, but HHHHHH feels less probable due to:
Inductive inferences are guaranteed to be true when:
Inductive inferences are guaranteed to be true when:
You have likely heard that there tend to be more murders whe…
You have likely heard that there tend to be more murders when people consume more ice cream. This is explained by the fact that both of these things tend to occur more frequently in the summer. Believing that murders and ice cream consumption are causally related is an example of:
Group of organisms of the same species occupying a certain a…
Group of organisms of the same species occupying a certain area and sharing a common gene pool.