Question
Keep getting this error in my lab. Please help.
Here is my cpp file and the error given. Thank you

4 #include 10streat Rationat . hi. .. Rational. cpp 5 #include 6 :include Z using nanespace std 9 int sain) 11 char ch; 12 char op 13 Rational ri, r2, r3; 14 15 cout nie lcome! I will evaluate expressions involving rational numbers for you 16 17 do 18 t 19 //Reading input 20 cout ee nEnter the expression (e.g., 1/2-3/4) with binary operator, and press enter: 21 cin ri op r2; 23 //Applying operations 25 t 26 27 28 29 30 31 32 r2 eequals to erer2): cout ee ri e else if(op cout «« rl <«« r2 «* equals to e(rl-r2): else if(op cout <« ri «* r2 «* equals to (rier2)i 35 36 37 38 39 else iflop else if(op 41 cout ee rl neequats to else if(op -) 45 cout <« ri <r2 «« equals to (riter2): 47 else if(op 49 50 51 52 53 54 cout <« ri e r2 e equals to (riar2): else iflop 56 57 58 cout e InContinue to test binary operators(y/n): 59cǐn >> ch; 61 62 cout < nin Byet Int 64 return ; 65 )
media%2F9b3%2F9b37f753-3fd3-46a9-a55a-97
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Error becasue rational number having some numerator and denominator.
To devide :
(r1.numerator * r2.denominator) / (r1.denominator* r2.numerator)

Add a comment
Know the answer?
Add Answer to:
Keep getting this error in my lab. Please help. Here is my cpp file and the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName();...

    please help me fix the error in here #include<iostream> #include <string> using namespace std; string getStudentName(); double getNumberExams(); double getScoresAndCalculateTotal(double E); double calculateAverage(double n, double t); char determineLetterGrade(); void displayAverageGrade(); int main() { string StudentName; double NumberExam, Average, ScoresAndCalculateTotal; char LetterGrade; StudentName = getStudentName(); NumberExam = getNumberExams(); ScoresAndCalculateTotal= getScoresAndCalculateTotal(NumberExam); Average = calculateAverage(NumberExam, ScoresAndCalculateTotal); return 0; } string getStudentName() { string StudentName; cout << "\n\nEnter Student Name:"; getline(cin, StudentName); return StudentName; } double getNumberExams() { double NumberExam; cout << "\n\n Enter...

  • Code in C++: Please help me fix the error in function: void write_account(); //function to write...

    Code in C++: Please help me fix the error in function: void write_account(); //function to write record in binary file (NOTE: I able to store data to a txt file but however the data get error when I try to add on data the second time) void display_all(); //function to display all account details (NOTE: This function is to display all the info that save account.txt which is ID, Name, and Type) void modify_account(int); //function to modify record of file...

  • C++ Code error help. I am getting the error: "expression must have a constant value, the...

    C++ Code error help. I am getting the error: "expression must have a constant value, the value of parameter 'n' ( declared at line 7) cannot be used as a constant" I am also getting this error at lines 65 and 66 with m and n. I do not know how to fix this. Here is my code and ive marked where the errors were with lines: #include<iostream> using namespace std; // Function to allocate memory to blocks as per...

  • Lab 5 Areas.cpp Marisol Castellanos villa #include # include using nanespace std; int main // ?NCLUDE...

    Lab 5 Areas.cpp Marisol Castellanos villa #include # include using nanespace std; int main // ?NCLUDE ANY NEEDED FILES HERE ciostrean cmath.ho const double PI 3.14159 DEFINE THE NAMED CONSTANT PI HERE AND SET ITS VALUE TO 3.14159 oat c radius, c area; loat s side, s area float t-height, tvidth, tarea; int choice: char ch; de // DECLARE ALL NEEDED VARIABLES HERE. GIVE EACH ONE A DESCRIPT?VE /I NAME AND AN APPROPRIATE DATA TYPE coutec"Progran to calculate areas of...

  • I am trying to run this program in Visual Studio 2017. I keep getting this build...

    I am trying to run this program in Visual Studio 2017. I keep getting this build error: error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution". 1>Done building project "ConsoleApplication2.vcxproj" -- FAILED. #include <iostream> #include<cstdlib> #include<fstream> #include<string> using namespace std; void showChoices() { cout << "\nMAIN MENU" << endl; cout << "1: Addition...

  • Can someone please help me. i keep getting an error in my code. I need it...

    Can someone please help me. i keep getting an error in my code. I need it to be on three seperate files! attached is my assignment and my code. c++ The class date Type implements the date in a program. Write the class functions as specified in the UML class diagram. The values for the month, day, and year should be validated (in the class functions) before storing the date into the data members. Set the invalid member data to...

  • my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip>...

    my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip> #include<string> #include "bookdata.h" #include "bookinfo.h" #include "invmenu.h" #include "reports.h" #include "cashier.h" using namespace std; const int ARRAYNUM = 20; BookData bookdata[ARRAYNUM]; int main () { bool userChoice = false; while(userChoice == false) { int userInput = 0; bool trueFalse = false; cout << "\n" << setw(45) << "Serendipity Booksellers\n" << setw(39) << "Main Menu\n\n" << "1.Cashier Module\n" << "2.Inventory Database Module\n" << "3.Report Module\n"...

  • what would be the pseudocode for my source code? Tools Plugins DoxyBlocks Settings Help program.cpp Code...

    what would be the pseudocode for my source code? Tools Plugins DoxyBlocks Settings Help program.cpp Code Blocks 16.01 e Edt View Search Project Build Debug Fortran wwSmith Tools Start here WOODSC program.cpp x #include <cstdlib> #include <iostream> include <string> Pinelude <stream include <string> using namespace std: int main(int argc, char argv11) 10 el itatre in stream: de lared to streamchele detasan input- string filein, fileout, key: Stringa tes are created to hold the nates and key Val of stream out...

  • please do the program in simple programming it is for my first c++ computer class i...

    please do the program in simple programming it is for my first c++ computer class i posted the example on pic 2,3 which is how this should be done Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium. Its rates vary depending on the type of service. The rates are computed as follows: Regular service: $10.00 plus the first 50 minutes are free. Charges for...

  • Trying to figure out how to complete my fourth case 4 (option exit), write a function...

    Trying to figure out how to complete my fourth case 4 (option exit), write a function that display a “Good Bye” message and exits/log out from user’s account displaying a menu (sign in, balance, withdraw and exit.. #include<iostream> #include <limits> using namespace std; void printstar(char ch , int n); double balance1; int main() { system("color A0"); cout<<"\n\t\t ========================================="<< endl; cout<<"\t\t || VASQUEZ ATM SERVICES ||"<< endl; cout<<"\t\t ========================================\n\n"<< endl; int password; int pincode ; cout<<" USERS \n"; cout<<" [1] -...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT