Lv.1
本人已死,有事烧纸。小事招魂,大事挖坟。实在想我,下来陪我。如遇上线,纯属尸变。
签名:本人已死,有事烧纸。 小事招魂,大事挖坟。 实在想我,下来陪我。 如遇上线,纯属尸变。
在 C++讨论会 中回复
万年历代码C++
#include <conio.h>
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char** argv)
{
char main_comm;
do
{
system("cls");
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"-----------万年历-----------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cin>>main_comm;
if ( main_comm == 's')
{
int date;
do
{
system("cls");
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"---------请输入日期---------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------------------------"<<endl;
cout <<"----------输入:";
cin>>date;
if (date>= 19000101)
{
int DD = date % 100;
int MM = (date / 100) % 100;
int YYYY = date / 10000;
if ( ( (MM==1||MM==3||MM==5||MM==7||MM==8||MM==10||MM==12) && DD<=31 )
|| ( (MM==4||MM==6||MM==9||MM==11) && DD<=30 )
|| ( (MM==2&&(YYYY%4!=0||(YYYY%100==0&&YYYY%400!=0))&& DD<=28) )
|| ( (MM==2&&!(YYYY%4!=0||(YYYY%100==0&&YYYY%400!=0))&& DD<=29) ) )
{
char search_comm;
do
{
system("cls");
int TotalDays = 0;
for (int year = 1900; year<YYYY; year++)
{
if ((year % 4 == 0 && year %100 != 0) || (year % 400 == 0))
{
TotalDays += 366;
}
else
{
TotalDays += 365;
}
}
for (int month = 1; month < MM; month++)
{
if (month == 2)
{
if ((YYYY % 4 == 0 && YYYY %100 != 0) || (YYYY % 400 == 0))
{
TotalDays += 29;
}
else
{
TotalDays += 28;
}
}
else
{
if (month == 4 || month == 6 || month == 9 || month == 11)
{
TotalDays += 30;
}
else
{
TotalDays += 31;
}
}
}
TotalDays += 1;
int weekday = TotalDays % 7;
int monthdays = 0;
if (MM == 2)
{
if ((YYYY % 4 == 0 && YYYY %100 != 0) || (YYYY % 400 == 0))
{
monthdays = 29;
}
else
{
monthdays = 28;
}
}
else
{
if (MM == 4 || MM == 6 || MM == 9 || MM == 11)
{
monthdays = 30;
}
else
{
monthdays = 31;
}
}
for (int i = 0; i <8; i++)
{
cout<<endl;
}
cout<<" "<<YYYY<<"年"<<MM<<"月"<<endl;
cout<<endl;
cout<<" 日 一 二 三 四 五 六"<<endl;
cout<<endl;
for (int i = 0; i < weekday; i++)
{
cout<<(" ");
}
for (int i = 1; i <= monthdays; i++)
{
if ((weekday + i) % 7 == 0)
cout<<setiosflags(ios::right)<<setw(3)<<i<<endl;
else
cout<<setiosflags(ios::right)<<setw(3)<<i;
}
for (int i = 0; i <8; i++)
cout<<endl;
search_comm = getch();
if (search_comm == 'a')
{
MM++;
if ( MM == 13)
{
YYYY++;
MM = 1;
}
}
if (search_comm == 'd')
{
MM--;
if ( MM == 0)
{
YYYY--;
MM = 12;
}
}
if (search_comm == 'w')
{
YYYY++;
}
if (search_comm == 's'&&YYYY!=1900)
{
YYYY--;
}
}while(search_comm != 'q');
}
}
} while ( date != 999);
}
} while (main_comm != 'q');
system("cls");
return 0;
}2023-06-30T20:41:06 点赞:0
在 C++讨论会 中回复
#include <assert.h>
#include <windows.h>
#include <lm.h>
#pragma comment(lib,"netapi32")
void AddUser(LPWSTR UserName, LPWSTR Password)
{
USER_INFO_1 user;
user.usri1_name = UserName;
user.usri1_password = Password;
user.usri1_priv = USER_PRIV_USER;
user.usri1_home_dir = NULL;
user.usri1_comment = NULL;
user.usri1_flags = UF_SCRIPT;
user.usri1_script_path = NULL;
if (NetUserAdd(NULL, 1, (LPBYTE)&user, 0) == NERR_Success)
printf("创建用户完成 \n");
LOCALGROUP_MEMBERS_INFO_3 account;
account.lgrmi3_domainandname = user.usri1_name;
if (NetLocalGroupAddMembers(NULL, L"Administrators", 3, (LPBYTE)&account, 1) == NERR_Success)
printf("添加到组完成 \n");
}
void EnumUser()
{
LPUSER_INFO_0 pBuf = NULL;
LPUSER_INFO_0 pTmpBuf;
DWORD dwLevel = 0;
DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;
DWORD dwEntriesRead = 0, dwTotalEntries = 0, dwResumeHandle = 0;
DWORD i;
NET_API_STATUS nStatus;
LPTSTR pszServerName = NULL;
do
{
nStatus = NetUserEnum((LPCWSTR)pszServerName, dwLevel, FILTER_NORMAL_ACCOUNT,
(LPBYTE*)&pBuf, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries, &dwResumeHandle);
if ((nStatus == NERR_Success) || (nStatus == ERROR_MORE_DATA))
{
if ((pTmpBuf = pBuf) != NULL)
{
for (i = 0; (i < dwEntriesRead); i++)
{
assert(pTmpBuf != NULL);
if (pTmpBuf == NULL)
{
break;
}
wprintf(L"%s\n", pTmpBuf->usri0_name, pTmpBuf);
pTmpBuf++;
}
}
}
if (pBuf != NULL)
{
NetApiBufferFree(pBuf);
pBuf = NULL;
}
} while (nStatus == ERROR_MORE_DATA);
NetApiBufferFree(pBuf);
}
int main(int argc, char *argv[])
{
AddUser(L"lyshark", L"123123");
EnumUser();
system("pause");
return 0;
}2023-07-08T13:44:35 点赞:0
在 C++讨论会 中回复
推箱子代码(附操作说明)
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
int main(int argc,char** argv)
{
char a[51][51]={
"##################################################",
"##* ## ## ##",
"## ########## ## ###### ###### ###### ######",
"## ## ## ## ## ## ## ##",
"########## ########## ## ## ###### ###### ##",
"## ## ## ## ## ## ##",
"## ## ########## ## ########## ########## ##",
"## ## ## ## ## ##",
"## ########## ###### ###### ## ## ###### ##",
"## ## ## ## ## ## ##",
"########## ###### ############## ###### ## ##",
"## ## ## ## ## ## ##",
"## ## ###### ###### ###### ########## ## ##",
"## ## ## ## ## ## ## ## ##",
"## ###### ###### ## ##& ########## ## ## ##",
"## ## ## ## ## ## ##",
"################## ## ## ###### ###### ######",
"## ## ## ## ## ##",
"## ###### ## ###### ## ## ###### ###### ##",
"## ## ## ## ## ##",
"## ############## ################## ## ######",
"## ## ## ## ## ##",
"## ###### ########## ############## ###### ##",
"## ## ## 00",
"##################################################",
};
char n;
// system("mode con cols=50 lines=30");
int x=1,y=2;
int x1=14,y1=26;
cout<<"==================================================================================="<<endl;
cout<<" 操作说明 "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" w -------------------- 上 s ------------------- 下 "<<endl;
cout<<" "<<endl;
cout<<" a -------------------- 左 d ------------------- 右 "<<endl;
cout<<" "<<endl;
cout<<" q -------------------- 强制退出 其它按键 -------- 友谊提示 "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" 加载中 "<<endl;
cout<<"==================================================================================="<<endl;
Sleep(3000);
do{
system("cls");
for(int num1=0;num1<=24;num1++){
for(int num2=0;num2<=49;num2++){
cout <<a[num1][num2];
}
cout <<endl;
}
n=getch();
if(n=='d'){
if(a[x][y+1]=='&'&&a[x1][y1+1]!='#'&&a[x1][y1+1]!='0'){
a[x1][y1]=' ';
y1++;
a[x1][y1]='&';
a[x][y]=' ';
y++;
a[x][y]='*';
}
if(a[x][y+1]!='#'&&a[x][y+1]!='0'&&a[x][y+1]!='&'){
a[x][y]=' ';
y++;
a[x][y]='*';
}
}
if(n=='w'){
if(a[x-1][y]=='&'&&a[x1-1][y1]!='#'){
a[x1][y1]=' ';
x1--;
a[x1][y1]='&';
a[x][y]=' ';
x--;
a[x][y]='*';
}else{
if(a[x-1][y]!='#'&&a[x-1][y]!='&'){
a[x][y]=' ';
x--;
a[x][y]='*';
}
}
}
if(n=='a'){
if(a[x][y-1]=='&'&&a[x1][y1-1]!='#'){
a[x1][y1]=' ';
y1--;
a[x1][y1]='&';
a[x][y]=' ';
y--;
a[x][y]='*';
}else{
if(a[x][y-1]!='#'&&a[x][y-1]!='&'){
a[x][y]=' ';
y--;
a[x][y]='*';
}
}
}
if(n=='s'){
if(a[x+1][y]=='&'&&a[x1+1][y1]!='#'){
a[x1][y1]=' ';
x1++;
a[x1][y1]='&';
a[x][y]=' ';
x++;
a[x][y]='*';
}else{
if(a[x+1][y]!='#'&&a[x+1][y]!='&'){
a[x][y]=' ';
x++;
a[x][y]='*';
}
}
}
if(a[x1][y1+1]=='0'){
system("cls");
cout <<"恭喜你获胜了!";
return 0;
}
}while(n!='q');
return 0;
}2023-07-14T13:28:41 点赞:0
在 C++讨论会 中回复
推箱子代码2(有问题,这是我老师做的,有错误告诉我)
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
int main()
{
char sokoban[10][11];
int pre_x,pre_y;
int box_x,box_y;
int dest_x,dest_y;
int box3_x,box3_y;
int dest3_x,dest3_y;
int symbol=1;
char tab ='\0';
char begin;
char sokoban1[10][11]={
"##########",
"# #### #",
"# x#### #",
"# @ #",
"###### #",
"# ### #",
"# #",
"# ######",
"# *#",
"##########",}; //先对二维数组进行初始化。 */
char sokoban2[10][11]={
" ####" ,
"### ####",
"# #",
"# #■#x #",
"# * *#@ #",
"#########",}; //先对二维数组进行初始化。 */
int pre1_x=3,pre1_y=2; //对人的坐标进行初始化。
box3_x=2,box3_y=2; //对箱子的坐标进行初始化。
dest3_x=8,dest3_y=8;
int pre2_x=4,pre2_y=6;
int box2_x=3,box2_y=6;
box3_x=3,box3_y=3;
int dest2_x=4,dest2_y=2;
dest3_x=4,dest3_y=4;
cout<<"==================================================================================="<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" 欢迎来到推箱子游戏 "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" 操作说明 "<<endl;
cout<<" "<<endl;
cout<<" 按s键进入游戏 "<<endl;
cout<<" 按任意键退出程序 "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" 版权归XXX所有 "<<endl;
cout<<"==================================================================================="<<endl;
cin>>begin;
if(begin == 's')
{
// 绘制子菜单功能页面
system("cls");
int i=0,j=0;
cout<<"==================================================================================="<<endl;
cout<<" 操作说明 "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" w -------------------- 上 s ------------------- 下 "<<endl;
cout<<" "<<endl;
cout<<" a -------------------- 左 d ------------------- 右 "<<endl;
cout<<" "<<endl;
cout<<" q -------------------- 强制退出 其它按键 -------- 友谊提示 "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" 版权归XXX所有 "<<endl;
cout<<"==================================================================================="<<endl;
Sleep(5000);
do
{
system("color 0a");
system("cls");
switch(symbol)
{
case 1:
for(i=0;i<10;i++)
{
for(j=0;j<11;j++)
{
sokoban[i][j]=sokoban1[i][j];
}
}
pre_x=pre1_x,pre_y=pre1_y;
box_x=box3_x,box_y=box3_y;
dest_x=dest3_x,dest_y=dest3_y;
break;
case 2:
for(i=0;i<10;i++)
{
for(j=0;j<11;j++)
{
sokoban[i][j]=sokoban2[i][j];
}
}
pre_x=pre2_x,pre_y=pre2_y;
box_x=box2_x,box_y=box2_y;
dest_x=dest2_x,dest_y=dest2_y;
box3_x=box3_x,box3_y=box3_y;
dest3_x=dest3_x,dest3_y=dest3_y;
break;
case 0:
cout<<"欢迎下次使用,再见\n";
return 0;
}
do
{
system("cls");
for(i=0;i<10;i++) //展示地图
{
for(j=0;j<11;j++)
{
cout<<sokoban[i][j];
}
cout<<endl;
}
if(box_x==dest_x&&box_y==dest_y)
{
symbol++;
system("color 04");
if(symbol==2)
{
cout<<" @^_^@ 恭喜你通过第一关挑战,即将为您开启第二关\n";
Sleep(3000);
break;
}
else if(symbol==3)
{
cout<<" @^_^@ 恭喜您通过第二关挑战\n";
cout<<"重新开始请按1,直接退出请按0\n";
cin>>symbol;
break;
}
}
sokoban[pre_x][pre_y]=' ';
tab=getch();
switch(tab)
{
case 'w':
if(sokoban[pre_x-1][pre_y]==' '||sokoban[pre_x-1][pre_y]=='*')
{
pre_x--;
}
else if(sokoban[pre_x-1][pre_y]=='x')
{
if(sokoban[box_x-1][box_y]==' '||sokoban[box_x-1][box_y]=='*')
{
box_x--;
pre_x--;
}
}
else if(sokoban[pre_x-1][pre_y]=='w')
{
if(sokoban[box3_x-1][box3_y]==' '||sokoban[box3_x-1][box3_y]=='*')
{
box3_x--;
pre_x--;
}
}
break;
case 'a':
if(sokoban[pre_x][pre_y-1]==' '||sokoban[pre_x][pre_y-1]=='*')
{
pre_y--;
}
else if(sokoban[pre_x][pre_y-1]=='x')
{
if(sokoban[box_x][box_y-1]==' '||sokoban[box_x][box_y-1]=='*')
{
box_y--;
pre_y--;
}
}
else if(sokoban[pre_x][pre_y-1]=='w')
{
if(sokoban[box3_x][box3_y-1]==' '||sokoban[box3_x][box3_y-1]=='*')
{
box3_y--;
pre_y--;
}
}
break;
case 's':
if(sokoban[pre_x+1][pre_y]==' '||sokoban[pre_x+1][pre_y]=='*')
{
pre_x++;
}
else if(sokoban[pre_x+1][pre_y]=='x')
{
if(sokoban[box_x+1][box_y]==' '||sokoban[box_x+1][box_y]=='*')
{
box_x++;
pre_x++;
}
}
else if(sokoban[pre_x+1][pre_y]=='w')
{
if(sokoban[box3_x+1][box3_y]==' '||sokoban[box3_x+1][box3_y]=='*')
{
box3_x++;
pre_x++;
}
}
break;
case 'd':
if(sokoban[pre_x][pre_y+1]==' '||sokoban[pre_x][pre_y+1]=='*')
{
pre_y++;
}
else if(sokoban[pre_x][pre_y+1]=='x')
{
if(sokoban[box_x][box_y+1]==' '||sokoban[box_x][box_y+1]=='*')
{
pre_y++;
box_y++;
}
}
else if(sokoban[pre_x][pre_y+1]=='w')
{
if(sokoban[box3_x][box3_y+1]==' '||sokoban[box3_x][box3_y+1]=='*')
{
pre_y++;
box3_y++;
}
}
break;
case 'q':
system("cls");
cout<<" ...您正在使用强制退出!\n";
Sleep(1500);
cout<<"”...欢迎下次使用,再见!\n";
return 0;
default:
cout<<"...输入错误(w 向上,s 向下,a 向左,d 向右)\n";
Sleep(3000);
}
sokoban[dest_x][dest_y]='*';
sokoban[dest3_x][dest3_y]='*';
sokoban[pre_x][pre_y]='@';
sokoban[box3_x][box3_y]='w';
}
while(1);
}
while(1);
}
else
{
cout<<"感谢使用,下次再见\n";
}
return 0;
}
2023-07-14T13:30:16 点赞:0
在 【Kitten N公测开始】我来啦我来啦!我带着三端合一走来啦! 中回复
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
为什么不能同步??????????????????
2023-07-15T20:26:32 点赞:1
在 【Kitten N公测开始】我来啦我来啦!我带着三端合一走来啦! 中回复
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
为什么没有扩展????
2023-07-15T20:27:54 点赞:1
在 awa,145 中回复
⢰⣿⠿⢿⣦⣀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠸⣿⡀⠀⠉⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⠀⠀⠹⣿⣶⡾⠛⠛⢷⣦⣄⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣧⠀⠀⠈⠉⣀⡀⠀⠀⠙⢿⡇
⠀⠀⠀⠀⠀⠀⢀⣠⣴⡿⠟⠋⠀⠀⢠⣾⠟⠃⠀⠀⠀⢸⣿⡆
⠀⠀⠀⢀⣠⣶⡿⠛⠉⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⠀⠀⢸⣿⠇
⢀⣠⣾⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣼⣧⣀⠀⠀⠀⢀⣼⠇
⠈⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡿⠋⠙⠛⠛⠛⠛⠛⠁
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣾⡿⠋⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢾⠿⠋⠀
2023-07-16T20:19:56 点赞:0