C/C++ >> Problem....
Posted by jkcnshs on 12:50:00 04-25-2002

I have problem with one of the small programs that I am writing. I am using it only to learn. It is a small program that uses classes to find the area of a triangle.
Here is the code:
#include <iostream>
#include <stdlib.h>
class TRIANGLE
{
public:

int base;
int height;
int area;
int Calc();
};

int TRIANGLE::Calc()
{

std::cout
std::cin -->--> base;
std::cout
std::cin -->--> height;
int area = ((base * height) / 2);
std::cout
}


int main()
{
TRIANGLE One;
One.Calc();
std::cout
system("PAUSE");
return 0;
}

The output is:
What is the base? 10
What is the height? 10
50
Press any key to continue...
I want to make it say, "The area is: " and then say the area. When I try to compile it with:
std::cout
It says: parse error before ';' on line 21
What do I do to get it right?
Posted by SilentStrike on 14:02:00 04-25-2002
std::cout area;
Posted by jkcnshs on 00:41:00 04-26-2002
Oh, ok, I see. I forgot all about that. Thanx SilentStrike.
Posted by MoX on 01:54:00 04-26-2002
I prefer printf() [addsig]
Posted by kpyro on 02:44:00 04-26-2002
I use cout. Just personal opinion. [addsig]
Posted by KaGez on 16:31:00 04-26-2002
both do practically the same, so I give a damned
[addsig]
Posted by MoX on 16:52:00 04-26-2002
Streams...for simple output on screen?

(/me starts yafsfw) [addsig]