c语言的坐标
Ⅰ c语言中若要输入坐标应该怎么办
先算出纵坐标的值,然后
用二维数组来存储坐标,如:int a[5][5]; 可以用a[0][0] a[0][1]....
a[i][j]....a[4][3] a[4][4],来存储5对坐标值,i、j分别是横坐标和纵坐标。
Ⅱ C语言编程怎样定义点的坐标啊,怎样实现随机点的产生
点的坐标的话你可以使用结构体struct,里面分别定义横纵坐标,随机点你去找下rand的用法吧。
Ⅲ c语言 坐标
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
int gdriver = DETECT, gmode, errorcode;
int xmax, ymax;
initgraph(&gdriver, &gmode, ""); \*初试化图形*/
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n",
grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
setcolor(getmaxcolor()); \*可以选择颜色比如color(2)是一种颜色*/
xmax = getmaxx();
ymax = getmaxy();
line(0, 0, xmax, ymax);
getch();
closegraph();
return 0;
}
自己远行一下看看就明白了
Ⅳ C语言控制台中怎么能获取光标当前的坐标值呢
1、::GetCursorPos会获取当前鼠标所在的点,参数为POINT结构变量的地址。
2、如下面的例子:
#include <stdio.h>
#include <afx.h>
void main()
{
POINT point;
::GetCursorPos(&point);
printf("x=%d,y=%d\n",point.x,point.y);
}
::GetCursorPos(&point);将获得的位置放入point变量中,通过point.x和point.y可以得知位置