How to display two results on the screen? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to display two results on the screen?

Advanced and experienced programmers, I need your help regarding c. My question is about c++, I am a beginner in this, and I would like to know if it is possible to generate a code that performs two operations and shows them on the screen, what I try to do (to be clearer) is to make a code that can multiply two fractions, and I understand that you need to multiply the first numerator with the second to obtain the result of the numerator, and multiply the first denominator by the second denominator to obtain the new denominator. I have everything I have understood, but I need to know how it is done so that those two results (of numerator and denominator) can be shown on the screen.

27th May 2019, 12:53 AM
Elder Yahir Meyer Sanchez
Elder Yahir Meyer Sanchez - avatar
2 Answers
+ 1
int n1,n2,d1,d2; cin >> n1; cin >> d1; cin >> n2; cin >> d2; cout << n1*n2 << "/" << d1*d2 << endl;
27th May 2019, 1:05 AM
Andres0b0100
Andres0b0100 - avatar
+ 1
You can use cout If you haven't done this tutorial, you should do it first.
27th May 2019, 1:00 AM
Loeschzwerg