Its showing size of type is unknown or zero

#include<conio.h>
#include<stdio.h>
#include<graphics.h>
#include<iostream.h>
#include<math.h>
int gc,gd=DETECT;
int x[3][4],tx,ty,i=0;
float turn[3][4];


			    void draw()
			{       moveto(x[0][0],x[1][0]);
				for(i=1;i<4;i++)
				{
					lineto(x[0][i],x[1][i]);
					x[2][i]=1;

				}
					lineto(x[0][0],x[1][0]);
			}

void rot()
{double ang;
float rot[3][3];
cout<<"enter the angle through which u want to rotate the figure\n";
cin>>ang;
rot[2][2]=1;
rot[2][1]=rot[2][0]=rot[1][2]=rot[0][2]=0;
rot[0][0]=rot[1][1]=cos(ang);
rot[0][1]=-sin(ang);
rot[1][0]=sin(ang);
}



void rotate()
{
for(int k=0;k<3;k++)
{for(int j=0;j<4;j++)
  {for(int i=0;i<3;i++)
    {
      turn[k][j]=turn[k][j]+((rot[j][i]) * (x[i][j]));
    }
  }
 }
}

void copy()
{
for(i=0;i<4;i++)
{x[0][i]=turn[0][i];
 x[1][i]=turn[1][0];
}
}

void main()

{clrscr;
initgraph(&gc,&gd,"");
cout<<"Enter the four cordinates of rectangle \n";
for(i=0;i<4;i++)
{
scanf("%d%d",&x[0][i],&x[1][i]);
}

draw();
rot();
rotate();
copy();
draw();
getch();

}

Please mail me at <EMAIL SNIPPED>

Recommended Answers

All 3 Replies

I'd be much more willing to look for the problem if you listed the line number the compiler complained about. Generally giving us all of the information you have about the problem is a good idea.

remember sin and cos takes angle in radians. But other than that
I don't know whats your problem?

Several problems are apparent.
(a) Turn is not initialized so will definitely be wrong
(b) loop variable j run 0 to 3 inclusive (j<4). so you access undefined memory locations in rot.
(c) rot is local only to the function rotate so the whole function is pointless. [make it global if you want it to work like that]
(d) clrscr; is incorrect, you must have it as clrscr(); if it doesn't take any parameters.
(e) I am sure you have function copy wrong, you use [0][1] rather than [0].

That will do to start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.