c++系统1.0

这是一个用C++编写的简易应用密码系统,用户需输入特定密码才能进入。系统提供查看时间、打开计算器和创建文本文件等功能。程序使用了iostream、fstream等库,通过控制台交互,延迟函数Sleep增加用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

没什么好说的,上代码

//应用密码系统 
//system("cls");
#include<bits/stdc++.h>
#include<windows.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <conio.h>
#include <cmath>
using namespace std;
long long mi=10281234,shu;
long long sr=0;
void towhere();
void Time();
void ji();
void test01(){
	system("cls");
	//2、创建流对象 ofs可以换成其他名字
	ofstream ofs;
	
	//3、指定打开方式
	ofs.open("cout.txt",ios::out );
	//4、写内容
    string str;
    cin>>str;
 	ofs<<str;
	
	//5、(重要!!!)关闭文件
	ofs.close();
	
	cout << "输出内容成功!" << endl;
	system("pause");
	towhere();  
}
int main()
{
	system("color 0A");
	while(1){
	cout<<"请";
	Sleep(50);
	cout<<"输";
	Sleep(50);
	cout<<"入";
	Sleep(50);
	cout<<"应";
	Sleep(50);
	cout<<"用";
	Sleep(50);
	cout<<"密";
	Sleep(50);
	cout<<"码";
	Sleep(50);
	cin>>shu;
	if(shu!=mi){
		cout<<"请重试\n";
		Sleep(350);
	} 
	else{
	break;
    }
	} 
	towhere(); 
}
void towhere(){
	system("color 0A");
	char w;
		SYSTEMTIME st;//定义本地时间变量,该变量为结构体

GetLocalTime(&st);//获取本地时间函数,参数为时间变量指针

	while(1){
	system("cls");
	cout<<"---------------------------"<<endl;
	cout<<"      欢迎,你要干什么?"<<endl;
	if(st.wHour<10) cout<<"0";
	cout<<"                      "<<st.wHour<<":";
	if(st.wMinute<10) cout<<"0";
	cout<<st.wMinute<<endl;
	cout<<"                    "<<st.wYear<<"/"<<st.wMonth<<"/"<<st.wDay<<endl;
	cout<<endl; 
	cout<<"   1.查看时间 2.打开计算器 "<<endl;
	cout<<endl; 
	cout<<"   3.创建记事本 4.敬请期待"<<endl;
	cout<<endl;
	cout<<"---------------------------"<<endl;
	cin>>w;
	if(w=='1') Time(); 
		else if(w=='2') ji();
			else if(w=='3') test01();
				else if(w=='4') towhere(); 
					else{towhere();} 
	}	
} 
void Time(){
	system("cls");
	SYSTEMTIME st;//定义本地时间变量,该变量为结构体

GetLocalTime(&st);
	while(1){
	char n;	
	
cout<<st.wYear<<"年";//显示某年

cout<<st.wMonth<<"月";//显示某月

cout<<st.wDay<<"日";//显示某日

int x=st.wDayOfWeek;

switch(x){
  case 0: cout<<"星期"<<"日"<<endl;break; 
  case 1: cout<<"星期"<<"一"<<endl;break; 
  case 2: cout<<"星期"<<"二"<<endl;break; 
  case 3: cout<<"星期"<<"三"<<endl;break; 
  case 4: cout<<"星期"<<"四"<<endl;break; 
  case 5: cout<<"星期"<<"五"<<endl;break; 
  case 6: cout<<"星期"<<"六"<<endl;break;
}
if(st.wHour<10) cout<<"0";
cout<<st.wHour<<"时";//显示某时
if(st.wMinute<10) cout<<"0";
cout<<st.wMinute<<"分";//显示某分
if(st.wSecond<10) cout<<"0";
cout<<st.wSecond<<"秒"<<endl;//显示某分
system("pause");
	towhere();
}
}
void ji(){
	system("cls");
	cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
	cout<<endl;
	cout<<"    提示:只有两个数!\n";
	cout<<endl;
	cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
	long double a,b,c;
	char f;
	cin>>a>>f>>b;
	if(f=='+'){
		c=a+b;
	}
	if(f=='-'){
		c=a-b;
	}
	if(f=='*'){
		c=a*b;
	}
	if(f=='/'){
		c=a/b;
	}
	cout<<a<<f<<b<<"="<<c;
	system("pause");
	towhere();
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值