Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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;
  
}