Hello all,
The program I am working on is calculation of areas (of shapes). For example, for triangle area calcuation I have:
else if (character == 't')
{
double b,h;
cout << "Enter base: ";
cin >> b;
cout << "Enter height: ";
cin >> h;
area= h * b/2;
cout << "The area of the triangle is: " << area << endl;
I would like to ask the user to specify the number of times he would like to calculate the area, then proceed to asking the parameters. In other words, how many triangles he would like to find the area to. So far I thought of putting each calculation (square, rectangle, etc..) into a function, and asking the user the number of times, then multiplying that number by the function (all theory of course since I have no clue how), but I'm sure there's a better way. If someone could help me with the most efficient way, I would greatly appreciate it.
Thank you