make a program that will input xcoordinate,ycoordinate,quadrants and results by using function..
this is the given program but it had a problem.. it is lacking..
#include %26lt;stdio.h%26gt;
getXcoordinate()
getYcoordinate()
getQuadrant()
displayQuadrant()
main()
{
getXcoordinate();
getYcoordinate();
getQuadrant();
displayQuadrant();
}
getXcoordinate();
{
printf();
scanf();
return ();
}
getYcoordinate();
{
printf();
scanf();
return ();
}
what's the next???
by getting quadrants, we used
if(x%26gt;0%26amp;%26amp;y%26gt;0)
q=1;
after getting quadrants?? what will be the next???
the error when i compile this program is "getYcoordinate" there is something with it...
please help me
Functions in c programming please??????
Your prototypes at the top need semi-colons and then your function definitions below main, take off the semi colon at the beginning of each function. That should make a big difference.
If you have questions feel free to ask directly.
Reply:Hi,
Try this:
--------------------------------------...
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
int getXcoordinate();
int getYcoordinate();
void getQuardant(int,int);
void main()
{
int x,y;
clrscr();
x=getXcoordinate();
y=getYcoordinate();
getQuardant(x,y);
getch();
}
int getXcoordinate()
{
int x;
printf("\nEnter X coordinate: ");
scanf("%d",%26amp;x);
return(x);
}
int getYcoordinate()
{
int y;
printf("\nEnter Y coordinate: ");
scanf("%d",%26amp;y);
return(y);
}
void getQuardant(int x,int y)
{
clrscr();
if(x%26gt;0 %26amp;%26amp; y%26gt;0) printf("Points (%d,%d) will lie in first quadrant.",x,y);
if(x%26lt;0 %26amp;%26amp; y%26gt;0) printf("Points (%d,%d) will lie in second quadrant.",x,y);
if(x%26lt;0 %26amp;%26amp; y%26lt;0) printf("Points (%d,%d) will lie in third quadrant.",x,y);
if(x%26gt;0 %26amp;%26amp; y%26lt;0) printf("Points (%d,%d) will lie in fourth quadrant.",x,y);
}
--------------------------------------...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment