Hello,我是老六工作室,C++模拟Windows系统系列又更新了!
今天我们来理清一下思路,并制作主页的代码(顺便说一下,赞爱点不点必须点)。
上一次的代码:
#define n1 532
#define D 250
#include<iostream>
#include<windows.h>
#include<conio.h>
using namespace std;
string username;
string password;
void openshow()
{
for(float i=0;i<=100;i+=0.3)
{
if(i<=25)
cout<<"系统设置中("<<i<<"%)..."<<endl;
else if(i<=50)
cout<<"数据加载中("<<i<<"%)..."<<endl;
else if(i<=75)
cout<<"文件解压中("<<i<<"%)..."<<endl;
else cout<<"设备调试中("<<i<<"%)..."<<endl;
_sleep(50);
system("cls");
}
}
void sound()
{
Beep(n1,D);
}
int setting()
{
cout<<"设置 Setting"<<endl;
cout<<"1:停止运行Windows C++"<<endl;
cout<<"2:参数"<<endl;
cout<<"3:关闭设置"<<endl;
int a;
cin>>a;
switch (a)
{
case 1:
{
cout<<"停止Windows C++运行中...";
_sleep(1000);
return 0;
}
case 2:cout<<"【老六工作室】制作"<<endl;
}
return 0;
}
void initialize()
{
cout<<endl;
cout<<"欢迎使用~"<<endl;
cout<<"[初始化1/2]请输入用户名:";
cin>>username;
cout<<"[初始化2/2]请输入密码:";
cin>>password;
int len=password.length();
while(len<6){
cout<<"请重新输入(6位以上):";
cin>>password;
len=password.length();
}
system("cls");
}
void user_handbook()
{
cout<<"使用说明:O键打开,W键关闭,C键复制,V键粘贴。"<<endl;
_sleep(2000);
cout<<"请按任意键继续...";
getch();
cout<<endl;
}
int main()
{
system("title Windows C++");
openshow();
initialize();
user_handbook();
//system("start https://baidu.com"); 浏览器
return 0;
}
Step 1-理清思路
我们可以来想一想主页的制作。
·主页分3个功能:应用,文件,系统。
·文件分为实际电脑文件和虚拟文件。
在这里,我画了一张图👇👇👇
Step 2-制作代码
先定义函数,因为没有返回值,所以使用void类型,取名为home,即void home()。
我想输出一个图标,但是如何输出一张图片呢?求代码!
等我亿会儿知道如何输出图片了,我就会更新C++模拟Windows系统(6.2)!
~尽情期待~