C++ Functions call by Reference Select only one of the following two questions.
ID: 673892 • Letter: C
Question
C++ Functions call by Reference Select only one of the following two questions. uestion #1 Write a program that converts the original inches to feet and inches. The program must have the following functions: I/This function accepts user input - the original inches void getInput( int& oinches); 1 inches and converts the inches to feet and inches. void convert( int oinches, int& feet, int& inches ); Implement the functions above in you main) program to demonstrate that they work accordingly.Explanation / Answer
#include<iostream>
using namespace std;
void getInput(int &oinches){
cin>>oinches;
}
void convert(int oinches,int &feet,int &inches){
inches = oinches;
feet = 0.0834*oinches;
}
int main(){
int oinches,feet,inches;
getInput(oinches);
convert(oinches,feet,inches);
cout<<"Feet: "<<feet;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.