On Feb 8, 2008 11:23 AM, umar hayat <[EMAIL PROTECTED]> wrote:
> ----- Original Message ----
> I AM UMAR     from islamabad
> --------------------------------------------------------
> #include<iostream.h>

Deprecated header.

> void main()

main returns int, not void, float or struct foo.

> {
>     int x1,x2,x3,y1,y2,y3;

All these variables are uninitialised.

>     int p1=(x1+x2+x3)/2;
> int p2=(y1+y2+y3)/2;

Initialised using uninitialised variables - the answers will be
nonsense. This also appears to assume the centroid is a triangle.

> cout<<" x component of centroid="<<p1<<endl;
> cout<<" y component of centroid="<<p2<<endl;

No newlines, so this program needn't output anything at all.

> }
> -------------------------------------------------

-- 
PJH

http://shabbleland.myminicity.com/ind

Reply via email to