Complete the main function below to complete the following tasks.
1) Prompt user for the day's temperature in Fahrenheit and call the function developed for the earlier
question to find an appropriate sport for the given temperature and print it to the monitor.
No need to rewrite the function just a call. Declare the necessary variables and include prototypes.
2) Assume a data file is open and ready to process (name it whatever you like). In the file there are a series
of integer numbers representing lengths of various ropes in centimeter. Write a C++ code segment
using a looping statement to read the length of each rope in centimeters from
the file and convert it to feet and inches (2 separate variables) and
print them to the monitor in a tabular format.
Use the function that was developed earlier.
Sample output:
Centimeter Feet Inches 124 4 9.827
//include all files you need
//Write the prototypes of the functions from previous question here
int main() { //Complete the rest of the code here to complete task 1 and 2
//Declare all necessary variables
Note:Could you plz provide the function code of earlier question in comment section.So that i can solve first question too.
Could you plz go through this code and let me know
if u need any changes in this.Thank You
_________________
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
void centimetersToFeetInches(int length,int&
feet,double& inches);
int main() {
//defines an input stream for the data file
ifstream dataIn;
int length;
double inches;
int feet;
//Setting the precision
cout<<setprecision(2)<<fixed<<showpoint;
//Opening the input file
dataIn.open("centimeters.txt");
//checking whether the file name is valid or not
if(dataIn.fail())
{
cout<<"** File Not Found **";
return 1;
}
else
{
cout<<"Centimeters\tFeet\tInches"<<endl;
while(dataIn>>length)
{
centimetersToFeetInches(length,feet,inches);
cout<<length<<"\t\t"<<feet<<"\t"<<inches<<endl;
}
}
//Closing the intput file
dataIn.close();
return 0;
}
void centimetersToFeetInches(int length,int& feet,double&
inches)
{
feet=length/30;
int rem=length%30;
inches=rem*0.393701;
}
____________________________
Output:

_______________Could you plz rate me well.Thank
You
Complete the main function below to complete the following tasks. 1) Prompt user for the day's...
Can
you help me to create this program, please?
Prompt the user for the user for a number of degrees in Fahrenheit as an int. That number should be passed to a function named ffocREFO. This function will do the necessary calculation to convert the passed temperature to degrees Celsius as a double. The function MUST have a void return type and have the following prototype: void ffccREF(double& celsius, int Faren); In your main, display both the entered temperature and...
Write a complete program that uses the functions listed below. Except for the printOdd function, main should print the results after each function call to a file. Be sure to declare all necessary variables to properly call each function. Pay attention to the order of your function calls. Be sure to read in data from the input file. Using the input file provided, run your program to generate an output file. Upload the output file your program generates. •Write a...
MUST BE WRITTEN IN C++
All user input values will be entered by the user from prompts in the main program. YOU MAY NOT USE GLOBAL VARIABLES in place of sending and returning data to and from the functions. Create a main program to call these 3 functions (5) first function will be a void function it will called from main and will display your name and the assignment, declare constants and use them inside the function; no variables will...
Complete a partially written C++ program that includes a function that return a value. The program is a simple calculator that prompts the user of 2 number and an operation (+, -, * or, /). The two number and the operator are passed to the function where the appropriate arithmetic operation is performed. The result is return to the main function () where the arithmetic operation and result are displayed. For example 3 * 4 = 12 The source code...
How do I complete this problem?
* CENGAGE MINDIAP > Terminal Opening Files and Performing FileInput in C++ 0 Opening Files and Performing File Input Flowers.cpp flowers.dat 1 // Flowers.cpp - This program reads names of flowers and whether they are grown in shade or sun from an input 2 // file and prints the information to the user's screen. 3.// Tnput: flowers.dat. 4 // Output: Names of flowers and the words sun or shade. Summary In this lab, you...
[IN JAVA] Copy the following code into your main.cpp and complete it public class Main { public static void main(String [] args) { int [] array1 = {5, 8, 34, 7, 2, 46, 53, 12, 24, 65}; int numElements = 10; System.out.println("Part 1"); // Part 1 // Enter the statement to print the numbers in index 5 and index 8 // put a space in between the two numbers and a new line at the end // Enter the statement...
Y F G Prompt and Store. 5. Prompt the user with "Enter your weight in pounds: "message and store in the weight variable. 6. Initialize an int variable named heightIn Inches to feet OſHeight times 12 plus Inches OfHeight. 7. Initialize a double variable named BMI to weight * 703.0 heightIrinches El VB 8. Initialize a double variable named ratio to height In Inches? 703.0 9. Initialize a double variable named lower Normal to 18.5 times ratio. 10. Initialize a...
soccerApp.cpp is used to test your code and contains the main function. No changes to this file are necessary. Inside of the soccerPlayer.cpp file, implement the three member functions that are specified in soccerPlayer.hpp. The member function definition for print is already provided. soccerPlayer.cpp: #include "soccerPlayer.hpp" void TopTwoPlayer::print() const { cout << left << setw(8) << "Name: " << setw(18) << name << setw(10) << "Country:" << setw(18) << country << setw(14) << "appearances:" << right << setw(3) << appearances...
Using the program segment below, write two short functions to complete the program. Use the test cases to ensure the program works properly. Prototypes: void int2bin(int, int[8]); The first function will convert an integer that is between 0 - 255 to its binary representation. You are to store the binary number in the array passed to the function. void printBinary(int[8]); The second function will print the binary number stored in the array passed to the function. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Test 1: 13...
Homework Part 1 Write a C program that declares and initializes a double, an int, and a char. You can initialize the variables to any legal value of your choosing. Next, declare and initialize a pointer variable to each of the variables Using printf), output the following: The address of each of the first three variables. Use the "Ox%x" format specifier to print the addresses in hexadecimal notation The value of each variable. They should equal the value you gave...