5. Write a full program to include the necessary. Brocessor directives, the function prototypes, the main function and the function calls to the defined functions In questions and 4. To properly call the previously listed functions, the main function must declare integer array of site, an input file stream, and three instances of Practiontype (frael fraca, and traca). Include code to initiate the integer array with values from a file initiate the fact and fruc2 instances with values from a file. Remember to print the contents of all array structures and Traction Type instances after initiation to the console to call the above listed functions properly with the appropriate parameters of the denominator of any of friction Type objects are nero, display the message cannot detection to the console. Otherwise, display the results of the add function call to the console (30p) Attach the core and screenshot of successful run on the roam /PASTE CODE HERE/ -
1 2 3 4 1/3 #include <iostream> using namespace std; Bclass fractiontype { public: int n, d; int gcd(int p, inta) { if (p == 0) { return a; 9 10 11 12 13 14 15 return ged(q % P, P); 16 fractionType add(fractiontype f1, fractiontype f2) { fractionType f3; f3.d = ged(f1.d, f2.d); f3.d = (f1.d * f2.d) / f3.d; f3.n = (f1.n) . (f3.d / f1.d) + (f2.n) (F32/f2.d); return f3; + 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 Bint main() { fraction Type 01, 02, 03; cout << "Enter ni: "; cin >> 01.n; B: while (1) { 23 Text Predictions: On Accessibility Investimte Display Settings four RA
un cout << "Enter d1: "; cin >> 01.d; if (01.d == 0) { cout << "di can't be zero!" << endl; 34 35 36 37 38 39 40 41 42 43 44 45 46 else { break; 47 cout << "Enter n2: "; cin >> 02.n; while (1) { cout << "Enter d2: "; cin >> 02.d; if (02.d == 0) { cout << "d2 can't be zero!" << endl; else LP 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 break; 03.n = @; o3.d = @; 03 - 03.add(01, 02); cout << "Resultant fraction(n3/d3) is: "; cout << o3.n << "/" << 03.d;
//4. #include<iostream> using namespace std; void findMinMax(int[], int& int&, int); int main() { int min, max: const int size = 8: int ray[size] - {6,3,2,1,5,7,8,4}; findMinMax(ray, max, min, size); return 0; void findMinMax(int ray[], int &max, int &min int size) { min ray[@]; max = cay[@]; for (int i = 0; i < size; i++) { if (ray > max) ray[il: 3 for (int i = 0; i < size; i++) { if (ray < min) min - ray: 3 max I cout << "maximum value is << max << "\n" << "minimum value is " << min; )
5. Write a full program to include the necessary. Brocessor directives, the function prototypes, the main function and t
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
5. Write a full program to include the necessary. Brocessor directives, the function prototypes, the main function and t
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!