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

PLEASE POST THE FULL CODE BELOW AND A SCREENSHOT OF THE OUTPUT. NEED IT ASAP!! H

ID: 3591502 • Letter: P

Question

PLEASE POST THE FULL CODE BELOW AND A SCREENSHOT OF THE OUTPUT. NEED IT ASAP!!

Heres the attached code:

rogramming Challenge: Task 0: Download and run testGetFrac.cpp file, run it and try to understand the code If you have any problem with task 0, ask your instructor for help. Now do the following: Write a function classExerciseFrac that reads a common fraction typed in by a user and returns the numerator, denominator through two type float output parameters and also returns the decimal value of the function. If the input arguments are 2 and 8, it should print "2/8" and the decimal value should be 0.25 Make sure you don't use integer division to calculate the decimal value (2/8 is 0 using integer division) Sample Input/Output: Enter two numbers: 4 The fraction is: 1/4 The decimal value: 0,25

Explanation / Answer

#include<iostream>
using namespace std;

void getFrac(int&, int&);
void classExerciseFrac(float &numerator, float &denominator, float &fraction);

int main()
{
float num, denom, fraction;
cout << "Enter two numbers: " << endl;
classExerciseFrac(num, denom, fraction);
cout<<"The fraction is: "<<num
<<"/" <<denom <<endl;
cout << "The decimal value: " << fraction << endl;
cin.get();
cin.get();
return 0;
}
void getFrac(int& numerator, int& denominator) {
char slash;
cin>> numerator >> slash >> denominator;
}

void classExerciseFrac(float &numerator, float &denominator, float &fraction) {
cin >> numerator >> denominator;
fraction = numerator / denominator;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote