so i decided to make a program in which u have area given and base/height etc .
so lets say
the sum is
area=11.6
base=?
height=2.9
the ans should be...AREA of triangle = 1upon2*b*h
11.6=1/2*b*2.9
h=11.6/2.9*2 = 8
so i am really confused how to make a program which will do something like this
like i cant declare cin because it wont take decimals ? ?:((
so how can i do it
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# include <iostream>
# include <string>
usingnamespace std;
int main ()
{
int a ,b,c;
string mystr;
cout <<"area to find breadth or height of a triangle " << endl;
cout << "enter ur breadth /height " << endl;
getline (cin,mystr);
cout <<" enter ur area" <<endl;
getline ( cin,mystr);
cout << " the ans is " << ?? ? ? << endl;
scanf ("%d%",&c);
return 0;
}
please tell me what can i put in the question marks ..or what other methods to create such programs