第6题:C++课程设计1.0版

                                                                            6  日历记事本

                         要求:带有日程提醒功能的日历。

显示信息:用户可以向前查询前一个月的日期,也可以向后查询下一个月的日期。

定时提醒:用户可以针对某一天来添加,删除和编辑这一天的日程提醒信息,当系统时间和提醒时间相吻合时,给出具有提示信息的对话框。

查询信息:用户可以查询到某个月的所有的提示信息。

程序:

/***************************
***       日历记事本   ****
&&&&&&&&&&&&&&&&&&&&&&&&& */
#include<iostream>
#include<iomanip>
#include<cstring>
#include<string>
using namespace std;

struct dates
{ 
	int month;
	int day[6][7];
	char * next1;//指向提醒信息的指针;
};//定义一个结构体dates;

struct not      
{
	int months;
	int days;
	char messages[250];
};//存放信息的结构体;


void f_month(int s[6][7],int month)//查询月份函数!!!!!!!
{
		int n,x,i,j;
	    if((month==9)||(month==12))
           n=0;
        else if((month==4)||(month==7))
           n=1;
        else if((month==1)||(month==10))
           n=2;
        else if(month==5)
            n=3;
        else if(month==8)
           n=4;
        else if(month==6)
           n=6;
        else
          n=5;
	    if(month==2)
         x=28;
        else if((month==4)||(month==6)||(month==9)||(month==11))
         x=30;
        else
         x=31;
        
        for(i=0;i<6;i++)
		{
		if(i==0)
		{
			if(n==0)
				for(j=0;j<6;j++)
				{s[i][0]=1;
				s[i][j+1]=s[i][j]+1;}
				else
			{
				for(j=0;j<n;j++)
			    s[i][j]=0;
			    for(j=n;j<7;j++)
				s[i][j]=s[i][j-1]+1;
			}
		}
		else
			for(j=0;j<6;j++)
			{
				s[i][0]=s[i-1][6]+1;
			    if(s[i][0]==x)
					break;
				else
				{
				s[i][j+1]=s[i][j]+1;
				if(s[i][j+1]==x)
					break;
				}
			}
			
		}
}
void out_month(int calendar[6][7],int month)//输出月份函数!!!!!!!
{
	int i,j,x;
	 if(month==2)
         x=28;
        else if((month==4)||(month==6)||(month==9)||(month==11))
         x=30;
        else
         x=31;
	cout<<"  一  二  三  四  五  六  日"<<endl;	
	for(i=0;i<6;i++)
		{
			for(j=0;j<7;j++)
			{
				if((calendar[i][j]>0)&&(calendar[i][j]<=x))
				cout<<setw(4)<<calendar[i][j];
				else
					cout<<setw(4)<<'\0';
			
			}
			cout<<endl;
		}
}



not addition(int month,int day)  //建立一个节点               
{                                                     
   
   not not_1={0,0,'\0'};
   not*head;
   head=¬_1;
  
   head->months=month;
   head->days=day;
   cout<<"请输入提醒信息:  ";
   cin>>head->messages;
   return not_1;
}
int main()    //main函数!! !
{
	dates calendar;
	dates* r;
	r=&calendar;
    
	not collect[12][31];
	not *h;
    int i,j;
	int m,n;//m月!,n天
    cout<<endl;
	cout<<endl;
	cout<<setw(37)<<"welcome"<<endl;
	cout<<endl;
	cout<<endl;
	cout<<setw(40)<<"日    历    表"<<endl;
    cout<<endl;
	cout<<setw(50)<<"-------------------------------"<<endl;
	cout<<endl;
	
	
	
	
	int choice;
	cout<<setw(40)<<"# 1.查询日历请按【1】    ";
    cout<<"& 2.查询事项请按【2】  "<<endl;
    cout<<endl;
	cout<<endl;
	cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
    cout<<"$ 4.退出系统请按【4】  "<<endl;
	
	cin>>choice;
	
	while(choice!=4)
	{
		while(choice==1)//查询日历
		{
          cout<<"请输入查询的月份:2014年/  ";
		  cin>>r->month;
          
		  f_month(r->day,r->month);
		  out_month(r->day,r->month);
          
		  cout<<"继续查询请按【1】"<<endl;
		  cout<<"返回主界面请按【2】"<<endl;
		  cin>>choice;
		  if(choice!=1)
		  {
			  cout<<setw(40)<<"# 1.查询日历请按【1】    ";
              cout<<"& 2.查询事项请按【2】  "<<endl;
              cout<<endl;
              cout<<endl;
	          cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
              cout<<"$ 4.退出系统请按【4】  "<<endl;
			  cin>>choice;
		  }
		}
        
		while(choice==2)//查询事项
		{
			int cheak;
			cout<<"1.查询全部事项按【1】"<<endl;
			cout<<endl;
			cout<<"2.查询某天事项按【2】"<<endl;
			cout<<endl;
			cout<<"3.查询某月事项按【3】"<<endl;
			cout<<endl;
			cout<<"4.返回上一级请按【4】"<<endl;
			cin>>cheak;
            if(cheak==4)
			{
				cout<<endl;
				cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                cout<<"& 2.查询事项请按【2】  "<<endl;
                cout<<endl;
	            cout<<endl;
	            cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                cout<<"$ 4.退出系统请按【4】  "<<endl;
				cin>>choice;
			}
			while(cheak==1)
			{
				
				cout<<"全部事项:   "<<endl;
				for(i=0;i<12;i++)
					for(j=0;j<31;j++)
					{
						h=&collect[i][j];
						if((h->days>0)&&(h->days<=31))
						{
							cout<<h->months<<"月  "<<h->months<<"日 提醒你:"<<h->messages<<endl;
						}	
					}
					cout<<endl;
                    cout<<endl;
				    cout<<"返回按【4】返回        ";
		         	cin>>cheak;
						cout<<endl;
                	cout<<"1.查询全部事项按【1】"<<endl;
			        cout<<endl;
					cout<<"2.查询某天事项按【2】"<<endl;
                 	cout<<endl;
					cout<<"3.查询某月事项按【3】"<<endl;
					cout<<endl;
					cout<<"4.返回主菜单【4】"<<endl;
			        cin>>cheak;
					cout<<endl;
					if(cheak==4)
				{
					cout<<endl;
					cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                    cout<<"& 2.查询事项请按【2】  "<<endl;
                    cout<<endl;
	                cout<<endl;
	                cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                    cout<<"$ 4.退出系统请按【4】  "<<endl;
					cin>>choice;
				}
			}
            
			while(cheak==2)
			{
				cout<<"需要查询事项月份:  ";
				cin>>m;
				cout<<"输入查询事项日期:  ";
				cin>>n;
			    h=&collect[m-1][n-1];
				if((h->days>0)&&(h->days<=31))
				cout<<h->months<<"月   "<<h->days<<"日  "<<h->messages<<endl;
				else
                    	cout<<'\0'<<"   "<<'\0'<<"  "<<"没有特别的事,亲!"<<endl;
				cout<<"继续查询按【2】"<<endl;
				cout<<"返回请按【4】"<<endl;
				cin>>cheak;
				cout<<endl;
				if(cheak!=2)
				{
					cout<<endl;
					cout<<"1.查询全部事项按【1】"<<endl;
		     	    cout<<endl;
					cout<<"2.查询某天事项按【2】"<<endl;
			        cout<<endl;
					cout<<"3.查询某月事项按【3】"<<endl;
					cout<<endl;
					cout<<"4.返回主菜单【4】"<<endl;
			        cin>>cheak;
					cout<<endl;
				}
				if(cheak==4)
				{
					cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                    cout<<"& 2.查询事项请按【2】  "<<endl;
                     cout<<endl;
	                  cout<<endl;
	                   cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                      cout<<"$ 4.退出系统请按【4】  "<<endl;
					cin>>choice;
				}
			}
			while(cheak==3)
			{
				cout<<"输入查询月份:  ";
				cin>>i;
				for(j=0;j<31;j++)
				{
					h=&collect[i][j];
					if((h->days>0)&&(h->days<=31))
						cout<<h->days<<"月  "<<h->months<<"日  "<<h->messages<<endl;
				} 
                  for(j=0;j<31;j++)
					{
						h=&collect[i][j];
					    if((h->days>0)&&(h->days<=31))
						break;
					    else if((!(h->days>0)&&(h->days<=31))&&(j==30))
						cout<<"该月  "<<"没有什么特别的事,亲!"<<endl;
					}  
			
				cout<<"继续查询按【3】"<<endl;
				cout<<"返回请按【4】"<<endl;
				cin>>cheak;
			    if(cheak!=3)
				{
				cout<<endl;
				cout<<"1.查询全部事项按【1】"<<endl;
			    cout<<endl;
				cout<<"2.查询某天事项按【2】"<<endl;
			    cout<<endl;
				cout<<"3.查询某月事项按【3】"<<endl;
				cout<<endl;
				cout<<"4.返回主菜单【4】"<<endl;
			    cin>>cheak;
				cout<<endl;
				}
				if(cheak==4)
				{
					cout<<endl;
					cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                    cout<<"& 2.查询事项请按【2】  "<<endl;
                    cout<<endl;
	                cout<<endl;
	                cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                    cout<<"$ 4.退出系统请按【4】  "<<endl;
					cin>>choice;
				}
			}
		}
		while(choice==3)//编辑事项
		{
			int edit;
			cout<<endl;
			cout<<"1.添加事项按【1】"<<endl;
            cout<<endl;
			cout<<"2.编辑事项按【2】"<<endl; 
		    cout<<endl;
			cout<<"3.删除事项按【3】"<<endl;
			cout<<endl;
			cout<<"4.返回主菜单【4】"<<endl;
			cin>>edit;
			cout<<endl;
			if(edit==4)
			{
				cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                   cout<<"& 2.查询事项请按【2】  "<<endl;
                    cout<<endl;
	             cout<<endl;
	           cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
               cout<<"$ 4.退出系统请按【4】  "<<endl;
				cin>>choice;
			}
			
			while(edit==1)
			{
				cout<<"需要添加事项月份:  ";
				cin>>m;
				cout<<"输入日期:  ";
				cin>>n;
				collect[m-1][n-1]=addition(m,n);
				
			
				cout<<"添加成功!"<<endl;
			    cout<<"继续按【1】  ";
				cout<<"返回按【4】   ";
				cin>>edit;
				cout<<endl;
			    if(edit!=1)
				{
					cout<<endl;
					cout<<"1.添加事项按【1】"<<endl;
                    cout<<endl;
					cout<<"2.编辑事项按【2】"<<endl; 
		            cout<<endl;
					cout<<"3.删除事项按【3】"<<endl;
		          	cout<<endl;
					cout<<"4.返回主菜单【4】"<<endl;
					cin>>edit;
					cout<<endl;
				}
				if(edit==4)
				{
				cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                      cout<<"& 2.查询事项请按【2】  "<<endl;
                 cout<<endl;
                   	cout<<endl;
	                  cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                   cout<<"$ 4.退出系统请按【4】  "<<endl;
					cin>>choice;
				}
			}
			while(edit==2)
			{
		     	cout<<"需要修改事项月份:  ";
				cin>>m;
				cout<<"需要修改事项日期:  ";
				cin>>n;
				collect[m-1][n-1]=addition(m,n);
                cout<<"继续按【1】  ";
				cout<<"返回按【4】   ";
				cin>>edit;
				cout<<endl;
			    if(edit!=2)
				{ 
					cout<<endl;
					cout<<"1.添加事项按【1】"<<endl;
                    cout<<endl;
					cout<<"2.编辑事项按【2】"<<endl; 
		            cout<<endl;
					cout<<"3.删除事项按【3】"<<endl;
					cout<<endl;
					cout<<"4.返回主菜单【4】"<<endl;
			        cin>>edit;
                    cout<<endl;
				}
				if(edit==4)
				{
					cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                     cout<<"& 2.查询事项请按【2】  "<<endl;
                     cout<<endl;
	                  cout<<endl;
	                 cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                     cout<<"$ 4.退出系统请按【4】  "<<endl;
					cin>>choice;
				}
			}
			while(edit==3)
			{
				
				cout<<"需要删除事项月份:  ";
				cin>>m;
				cout<<"需要删除事项日期:  ";
				cin>>n;
				h=&collect[m-1][n-1];
				h->days=0;
				h->months=0;
			
			    cout<<"删除成功!"<<endl;
				cout<<"继续按【1】  ";
				cout<<"返回按【4】  ";
				cin>>edit;
				cout<<endl;
			    if(edit!=3)
				{
				    cout<<endl;
					cout<<"1.添加事项按【1】"<<endl;
                    cout<<endl;
					cout<<"2.编辑事项按【2】"<<endl; 
		            cout<<endl;
					cout<<"3.删除事项按【3】"<<endl;
					cout<<endl;
					cout<<"4.返回主菜单【4】"<<endl;
			        cin>>edit;
					cout<<endl;
				}
				if(edit==4)
				{
					cout<<setw(40)<<"# 1.查询日历请按【1】    ";
                      cout<<"& 2.查询事项请按【2】  "<<endl;
                     cout<<endl;
	               cout<<endl;
	                 cout<<setw(40)<<"* 3.编辑事项请按【3】    ";
                    cout<<"$ 4.退出系统请按【4】  "<<endl;
					cin>>choice;
				}
			}
		}
	}
		
	cout<<"--------------------------------------"<<endl;
	cout<<"已经退出!  谢谢使用!!"<<endl;

        return 0;
}

		

主界面:

查看日历:

添加信息:

 

查看某日信息:


查看全部:

修改信息:

删除信息:

退出系统:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
代码下载:完整代码,可直接运行 ;运行本:2022a或2019b或2014a;若运行有问,可私信博主; **仿真咨询 1 各类智能优化算法改进及应用** 生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化 **2 机器学习和深度学习方面** 卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断 **3 图像处理方面** 图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知 **4 路径规划方面** 旅行商问(TSP)、车辆路径问(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化 **5 无人机应用方面** 无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配 **6 无线传感器定位及布局方面** 传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化 **7 信号处理方面** 信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化 **8 电力系统方面** 微电网优化、无功优化、配电网重构、储能配置 **9 元胞自动机方面** 交通流 人群疏散 病毒扩散 晶体生长 **10 雷达方面** 卡尔曼滤波跟踪、航迹关联、航迹融合

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值