當前位置:首頁 » 編程語言 » c語言的坐標

c語言的坐標

發布時間: 2023-07-09 04:12:06

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可以得知位置

熱點內容
電腦怎麼選擇配置 發布:2025-05-14 10:46:12 瀏覽:325
電腦怎麼不顯示手機連接伺服器失敗 發布:2025-05-14 10:42:28 瀏覽:9
安卓如何下載lv手游 發布:2025-05-14 10:35:45 瀏覽:383
pythondict添加key 發布:2025-05-14 10:33:59 瀏覽:382
柱子箍筋加密區長度 發布:2025-05-14 10:18:29 瀏覽:352
雲伺服器和內網穿透哪個好 發布:2025-05-14 10:16:41 瀏覽:627
安徽新能源網路配置是什麼 發布:2025-05-14 10:06:24 瀏覽:631
pinode搭建伺服器 發布:2025-05-14 10:04:23 瀏覽:4
電腦伺服器ip名稱 發布:2025-05-14 10:01:09 瀏覽:749
connectorpython 發布:2025-05-14 09:48:50 瀏覽:763