⑴ 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; //输出结果
}非常感谢您的耐心观看,如有帮助请采纳,祝生活愉快!谢谢!