Re: [Dev-C++] please help me to write formulas
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Verne H. B. <ve...@sy...> - 2005-03-28 18:45:28
|
I haven't heard back from you but here's a simple Console type program =
that would do what you wish if it works as it works for me. This could =
easily be made into a loop with if and while and such but does the trick =
as is right now.
********************************************
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
=20
int height, width1,width2, area;
cout << " Please give me the height then the width and \n"
<< " in inches then the area will be given to you.\n\n";
cin >> height;
cin >> width1 >> width2;
cout << "\nThe area of this is "<< (height * (width1 + width2)) / =
144 << " square feet!\n";
system("PAUSE");
return EXIT_SUCCESS;
}
**************************************
Verne
Hi
I am new here (and still studying C++),
I would love to know how to do make my program check out the type of =
the user input, to make it more clear, am trying to write geometric =
formulas ...... and it works by making the user enter his datas // =
height area width etc....and lets say am doing the square function (not =
a class because am practicing now functions and I would like to take my =
time before I use classes) and in square function lets say that there =
are these (formulas):
area =3D height * width; // this is in case the MISSING variable =
(input) is the area
height =3D area / width; // in case the MISSING input is the Height=20
and so on
remember please that the user must enter the data and if he wites x or =
y (height, width) then the formula that needed to find (any missing =
argument or a value of variable) takes the action to do that, but how to =
make the program check what type of the input if I HAVE TO declare a =
variable for output (cin >> float a; for example).
I mean the user cant type x or y if the out put is float //which =
should be!=20
please help me,=20
and thank very much.
ligeti_78
-------------------------------------------------------------------------=
-----
Do you Yahoo!?
Make Yahoo! your home page |