⑴ c語言坐標系怎麼編寫
用(x,300-y)來表示,則就是表示橫坐標在距離顯示器頂端300個像素的地方。c語言中一般是在顯示器的中央附近吧,因為c語言中顯示VGA好像是640*480。當然300是可以改的,任何一個都可以,視情況而定。
⑵ 求一C語言編程,輸入坐標(x,y)後得到的輸出結果是(y,x)。。求大神指導啊。。
#include <stdio.h>
int main()
{
float x,y;
printf("please enter x,y: ");
scanf("%f,%f",&x,&y);
printf("%5.2f,%5.2f ",y,x);
return 0;
}
程序已運行過,不知道你有沒有其他要求,運行結果:

⑶ C語言編寫程序輸入任意兩個量作為x,y的坐標,計算該點到原點的距離及與x軸的夾角。
#include<stdio.h>
#include<math.h>
#definePI3.1415926535
intmain()
{
doublex=0,y=0;
doubles=0;
doubleangle;
printf("請輸入x=");
scanf("%lf",&x);
printf("請輸入y=");
scanf("%lf",&y);
printf("輸入的點坐標為(%f,%f) ",x,y);
s=sqrt(fabs(x)*fabs(x)+fabs(y)*fabs(y));
angle=atan2(y,x)*180/PI;
printf("該點到原點的距離:%lf ",s);
printf("該點到原點x軸的夾角:%lf° ",angle);
}
源碼如上
運行結果如下

⑷ 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語言,如何在指定坐標輸入數據
用gotoxy和gets吧~~~
gotoxy(old_x,old_y);//跳轉到指定坐標輸出信息
cprintf("User Name:");//在指定坐標處輸出User Name:
gotoxy(old_x,old_y+2);//跳轉到指定坐標輸入信息
gets(name);//輸入用戶名,name為所定義的字元數組
這是我做一個游戲界面的用戶名和密碼輸入的代碼~~你看看吧,希望對你有所幫助。。
⑹ C語言兩點距離 輸入兩點坐標(X1,Y1),(X2,Y2)(0<=x1,x2,y1,y
您好,對於你的遇到的問題,我很高興能為你提供幫助,我之前也遇到過喲,以下是我的個人看法,希望能幫助到你,若有錯誤,還望見諒!。#include<iostream.h>
#include<math.h>
void main()
{
double x1,x2,y1,y2;
cout << "x1="; cin >> x1;
cout << "x2="; cin >> x2;
cout << "y1="; cin >> y1;
cout << "y2="; cin >> y2; //輸入坐標
double l = sqrt((y1 - x1) * (y1 - x1) + (y2 - x2) * (y2 - x2)); //計算結果
cout<<"兩點間距離為"<<l<<endl; //輸出結果
}非常感謝您的耐心觀看,如有幫助請採納,祝生活愉快!謝謝!
