用c++写一个连点程序
时间: 2023-11-03 11:05:59 浏览: 44
好的,以下是一个简单的 C 语言程序,可以连接两个点:
```c
#include <stdio.h>
int main() {
int x1, y1, x2, y2;
printf("请输入点1的坐标(x1, y1): ");
scanf("%d %d", &x1, &y1);
printf("请输入点2的坐标(x2, y2): ");
scanf("%d %d", &x2, &y2);
printf("点1(%d, %d) 和点2(%d, %d) 已连接!", x1, y1, x2, y2);
return 0;
}
```
这个程序会提示用户输入两个点的坐标(x, y),然后输出这两个点已经连接起来的信息。
如果您有其他问题,欢迎随时提出!
相关问题
用c++写一个表白程序
好的,以下是一个简单的表白程序,使用 C++ 编写:
```cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "请输入你喜欢的人的名字:";
cin >> name;
cout << endl;
cout << "亲爱的" << name << "," << endl;
cout << "我想对你说:" << endl;
cout << "我喜欢你,喜欢你的一切。" << endl;
cout << "希望我们能在一起,共度美好的时光。" << endl;
return 0;
}
```
这个程序会先让用户输入喜欢的人的名字,然后输出一段表白的话。用户可以将程序编译后运行,按照程序提示输入名字,就可以看到程序输出的表白话语了。
用C++写一个关机程序
我可以回答这个问题。以下是一个简单的关机程序的示例:
#include <stdlib.h>
#include <stdio.h>
int main()
{
system("shutdown /s /t 0");
return 0;
}
这个程序使用了系统命令来执行关机操作。在Windows系统中,"shutdown"命令可以用来关机、重启或注销计算机。"/s"参数表示关机,"/t 0"表示立即执行关机操作。