I wrote a project that calculates the area of the triangle. I have wrote this program.
#include <iostream>
using namespace std;
int main()
{
int first, two, three;
int all = (first + two) * three;
cout << "Enter first num: ";
cin >> first;
cout << "\nEnter second num: ";
cin >> two;
cout << "\nEnter num three: ";
cin >> three;
cout << "You have choosed to do: (" << first << " + " << two << ") * " << three;
cout << "\n\nThis is equal to: " << all;
return 0;
}
Instead of going down a line and writing cin
and cout
every time, is there a way to shorten this project and make it shorter.
Maybe like write the cout
and the cin
in a single line ?
or anything else just to make it look more clean and nice.
it looked messy.
Thanks!