1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vekshin1
3 years ago
15

Write a program that reads two fractions such as 1/2 and 1/4 and computes and stores the sum, the difference, the product and th

e result of dividing one by the other in four other fractions, respectively. Display the four resulting fractions. The following is a sample interaction between the user and the program: Enter two fractions: 1/2 1/4 Sum fraction: 6/8 Difference: 2/8 Product: 1/8 Quotient: 4/2 Press any key to continue. If n1/d1 and n2/d2 are the two fractions, their sum is given by: n1d2+ n2d1/d1d2 their difference is given by: n1d2-n2* d1/d1d2 Product is: n1n2/d1d2 Quotient: nl. d2/d1n2 Make sure the program pauses and waits for a key to be pressed before continuing. Put your name on top as a comment. Use comments to explain where your code may not be clear enough. After building and testing the program, submit the cpp file. There are two steps in submitting an assignment: first click Choose File and once you locate the file, click Upload to upload it. Once you have uploaded the file click Finish to submit. It will not be submitted until you click Finish. Make sure not to click Finish before uploading the files, as it will send a blank page and you can't resubmit. Each student must write his or her own program.
Computers and Technology
1 answer:
Vesnalui [34]3 years ago
5 0

Answer:

1: #include <iostream>

2: using namespace std;

3: int main()

4: {

5: int a,b,c,d;

6: cout<<"n1: ";

7: cin>>a;

8: cout<<"d1: ";

9: cin>>b;

10: cout<<"n2: ";

11: cin>>c;

12: cout<<"d2: ";

13: cin>>d;

14: int top = (a*d)+(b*c);

15: int bottom = b*d;

16: cout<<"Sum: "<<top<<"/"<<bottom<<"\n";

17: top = (a*d)-(b*c);

18: cout<<"Difference: "<<top<<"/"<<bottom<<"\n";

19: top = a*c;

20: cout<<"Product: "<<top<<"/"<<bottom<<"\n";

21: top = a*d;

22: bottom = b*c;

23: cout<<"Quotient: "<<top<<"/"<<bottom<<"\n";

24: return 0;

25: }

Explanation:

The Program is written in C++ programming language

The Program is left numbered

Line 5 was used for variable declaration.

Variables a,b represents the numerator and denominator of the first fraction

While variables c,d represent the numerator and denominator of the second fraction

Line 6 prints "n1" without the quotes which represents the numerator of the first fraction

Line 7 accepts input for the numerator of the first fraction.

Line 8 prints "d1" without the quotes which represents the denominator of the first fraction

Line 9 accepts input for the denominator of the first fraction.

Line 10 prints "n2" without the quotes which represents the numerator of the second fraction

Line 11 accepts input for the numerator of the second fraction.

Line 12 prints "d2" without the quotes which represents the denominator of the second fraction

Line 13 accepts input for the denominator of the second fraction.

Line 14 and 15 calculate the sum of the fractions which is then printed on line 16

Line 17 calculates the difference of the fractions which is then printed on line 18

Line 19 calculates the product of the fractions which is then printed on line 20

Line 21 and 22 calculates the quotient of the fractions which is then printed on line 23

You might be interested in
Which measure should you take for the periodic maintenance of your computer? You need to invest in a for_______________ the peri
Sergio039 [100]
I believe the answer is <span>annual maintenance
</span><span>annual maintenance refers to the system maintenance that being done at a regular time period (most commonly done at least every 6 month)
This is really necessary in order to detect potential virus/malware that would compromise the information within your computer.</span>
3 0
3 years ago
Read 2 more answers
You find information that you know to be classified on the internet. What should you do.
melomori [17]

A person is to find the information to be classified on the internet  are the best in the screenshot.

What is internet?

The word “internet” is also referred to as “net.” The global system of networks known as the Internet. Online services offered via the Internet include social media, email, and others. The without internet  are the not possible to share the information at the time.

A person is to find the information through which the internet is the best to justify. There used of the internet are the search the information with the help of the internet are the mic, keyboard. The information are the save and the screenshot was the used.

As a result, the person is to find the information to be classified on the internet  are the best in the screenshot.

Learn more about on internet, here:

brainly.com/question/13308791

#SPJ2

5 0
1 year ago
Read 2 more answers
How do science, mathematics, and technology each influence engineering
Cerrena [4.2K]

Answer:

In order to start engineering you must know the basics Science, Math, and Technology. For example you need math to get all the parts in the right place and fix any pieces that need to be angled right, science because you need to know what happens if you put this with that if it’ll spark break or anything, and technology because you need to know the different pieces and their purpose, hope it helps!

Explanation:

6 0
3 years ago
Read 2 more answers
How can i become an ailen?
DIA [1.3K]
Go to a different state as a migrant and then your a alien
8 0
3 years ago
Read 2 more answers
write a c program to insert and delete values from stack( to perform pop and push operations) using an array data structure
Alexxx [7]

Answer:

<u>How to implement a stack in C using an array?</u>

A stack is a linear data structure that follows the Last in, First out principle (i.e. the last added elements are removed first).

This abstract data type​ can be implemented in C in multiple ways. One such way is by using an array.

​Pro of using an array:

No extra memory required to store the pointers.

Con of using an array:

The size of the stack is pre-set so it cannot increase or decrease.

3 0
2 years ago
Other questions:
  • Format Painter cannot be used to copy only character attributes. True or False
    12·1 answer
  • Why is it a mistake to put email addresses of people who don't know each other in the "To:" field?
    8·2 answers
  • A database has a built-in capability to create, process and administer itself.
    14·1 answer
  • While designing your network's VLAN topology, your team has decided to use a centrally managed DHCP server rather than creating
    8·1 answer
  • In working on the conceptual design of the new database, Ken determines that the "office" field in one of the tables must includ
    8·1 answer
  • You are asked to check your company’s configurations to determine if any filters should be built to stop certain ICMPv6 traffic.
    9·1 answer
  • You would like to narrow your search on this topic.
    15·2 answers
  • how does a demilitarized zone (dmz) work. A.By preventing a private network from sending malicious traffic to external networks
    10·1 answer
  • What are the main security weaknesses of coaxial cable, twisted pair cable, and fiber optic cable? How might the router itself b
    8·1 answer
  • Genres are useful for many reaseons. What are some explanations you can think of for how genres can be useful to players, game d
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!