1

 #include "date.h"
#include "utils.h"
#include <iostream>
using std::cout;
using std::endl; // 补足程序,实现Date类中定义的成员函数
Date::Date():year(),month(),day(){
} Date::Date(int y, int m, int d):year(y),month(m),day(d){
} void Date::display(){
cout<<year<<"-"<<month<<"-"<<day<<endl;
} int Date::getYear() const{
return year;
} int Date::getMonth() const{
return month;
} int Date::getDay() const{
return day;
} int Date::dayOfYear(){
int i=;
if(isLeap(year)==true)
i=;
switch (month)
{
case :
return day;
case :
return +day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
case :
return +i+day;
}
}

——————————————以下为考试后补充内容————————————

2、

 #ifndef ARTICLE_H
#define ARTICLE_H #include<string>
using std::string; class Article{
public:
Article();
void changetit();
void changecon();
void print();
private:
string title;
string content;
string publicTime;
static string lastUpdateTime;
} #endif

article.h

 //这个头文件里包含了可用工具函数的声明 

 #include <string>
using std::string; // 函数声明
// 返回当前系统时间,格式诸如2019-4-30 13:30
string getCurrentTime();

utils.h

 #include<iostream>
#include"article.h"
#include "utils.h"
using namespace std; string Article::lastUpdateTime = getCurrentTime(); Article::Article(){
cout << "输入标题:";
cin >> title;
cout << "输入内容:";
cin >> content;
publicTime = lastUpdateTime;
} void Article::changetit() {
cout << endl;
cout << "更改标题为:";
cin >> title;
} void Article::changecon(){
cout << endl;
cout << "更改内容为:";
cin >> content;
} void Article::print(){
cout << "==================文章信息==================" << endl;
cout<<"标题:\t\t"<<title<<endl;
cout<<"内容:\t\t"<<content<<endl;
cout<<"发布时间:\t\t"<<publicTime<<endl;
cout<<"最后一次更新时间:\t"<<lastUpdateTime<<endl;
}

article.cpp

 #include "utils.h"
#include <ctime>
using std::string; const int SIZE = ; // 函数功能描述:返回当前系统时间
// 参数描述:无参数
// 返回值描述:以string类型返回系统当前时间,格式诸如2019-4-30 13:30
string getCurrentTime() { time_t now = time(); // 获取当前系统日历时间 struct tm *local_time = localtime(&now); // 把系统日历时间转换为当地时间 char date[SIZE]; strftime(date, SIZE, "%Y-%m-%d %H:%M", local_time); return (string(date));
}

utils.cpp

 #include<iostream>
#include"utils.h"
#include"article.h" using namespace std; int main() {
Article a;
a.print(); a.changetit();
a.changecon(); a.print(); system("pause");
return ;
}

main.cpp

并未得出最后效果,这个错误也不知如何解决。

3、

 #include "info.h"
#include <iostream>
#include<string>
#include<vector>
// 补足必要的头文件
// 。。。
using namespace std; int main() { // 补足程序,实现题目要求
// 。。。
vector<Info> audienceInfoList;
string nicknameN, contactN, cityN;
int nN,sum=; while ((cin >> nicknameN >> contactN >> cityN >> nN )&& (sum<) ) {
Info a(nicknameN, contactN, cityN, nN);
audienceInfoList.push_back(a);
sum += nN; }
cout << "目前已有" << sum << "人预定参加。" << endl;
for (unsigned i = ;i < audienceInfoList.size();i++)
audienceInfoList[i].print(); system("pause");
return ;
}

main.cpp

kao shi的更多相关文章

  1. kao shi di er ti(还没有订正)

    // 离散化点 思路应该是对的 吧 但没时间去检查编译上的错误 #include <bits/stdc++.h> using namespace std; ; #define ri reg ...

  2. dwr消息推送和tomcat集群

    网友的提问: 项目中用到了dwr消息推送.而服务端是通过一个http请求后 触发dwr中的推送方法.而单个tomcat中.服务器发送的http请求和用户都在一个tomcat服务器中.这样就能精准推送到 ...

  3. 【Gym 100733D】Little thief Shi

    题 Shi realized that he was almost out of money, even renting Shitalian lands. Shi was walking on a s ...

  4. hdu 4081 Qin Shi Huang's National Road System (次小生成树)

    Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/3 ...

  5. UValive 5713 Qin Shi Huang's National Road System

    Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/3 ...

  6. hdu 4081 Qin Shi Huang's National Road System (次小生成树的变形)

    题目:Qin Shi Huang's National Road System Qin Shi Huang's National Road System Time Limit: 2000/1000 M ...

  7. HDU 4081 Qin Shi Huang's National Road System 次小生成树变种

    Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/3 ...

  8. 【最小生成树】UVA1494Qin Shi Huang's National Road System秦始皇修路

    Description During the Warring States Period of ancient China(476 BC to 221 BC), there were seven ki ...

  9. Qin Shi Huang's National Road System HDU - 4081(树形dp+最小生成树)

    Qin Shi Huang's National Road System HDU - 4081 感觉这道题和hdu4756很像... 求最小生成树里面删去一边E1 再加一边E2 求该边两顶点权值和除以 ...

随机推荐

  1. XAMPP非本地访问被拒绝解决办法

    问题场景: 本机搭建一个apache服务器,正常访问XAMPP目录下的页面. 手机接入同一wifi,以电脑ip方式访问该目录下的页面:提示:Access Denied Access to the re ...

  2. ubuntu账户密码正确但是登录不进去系统

    ubuntu12.04管理员账户登录不了桌面,只能客人会话登录 求助!!ubuntu12.04管理员账户登录不了桌面,只能客人会话登录. ctrl+alt+f1 ,切换到tty1,输入管理员帐号和密码 ...

  3. Windows c++程序的基本结构

    Windows c++程序的基本结构 1.一个完整的Windows应用程序通常由五种类型的文件组成 C语言源程序文件 头文件 模块定义文件 资源描述文件 项目文件 2.Windows应用程序构成基本框 ...

  4. Maven项目下java.lang.ClassNotFoundException常规解决办法

    网上很多要修改.class .project的比较麻烦有时候还不一定管用.下面的方法适合于项目用已经引用了jar,但是运行时却ClassNotFound,请用如下方法试试: 严重: Error con ...

  5. NetLink通信机制学习

    Netlink套接字是用以实现用户进程与内核进程通信的一种特殊的进程间通信(IPC) ,在 Linux 2.4 版以后版本的内核中,几乎全部的中断过程与用户态进程的通信都是使用 netlink 套接字 ...

  6. spark standalone集群部署 实践记录

    本文记录了一次搭建spark-standalone模式集群的过程,我准备了3个虚拟机服务器,三个centos系统的虚拟机. 环境准备: -每台上安装java1.8 -以及scala2.11.x (x代 ...

  7. Ubuntu命令基础

    Ubuntu命令基础 1.打开终端窗口快捷键. Ctrl+alt+t 2.更新设置root密码. $sudo passwd  root  3.切换到root用户用su,前提是自己设置了root密码(看 ...

  8. 轉:Jquery绑定img的click事件

    用JQUERY给IMG element绑定click事件的时候,直接用img.click(function(){...})不起作用,如下面代码$("img.ms-rteImage-Light ...

  9. Oracle EBS Add Responsibility to User by the Responsibility reference of Other User.

    Oracle EBS 11i Add Responsibility to User by the Responsibility reference of Other User. Warning: R1 ...

  10. Android-Activity启动模式-应用场景

    在上一篇博客中,Android-Activity启动模式(launchMode),就介绍了Activity四种启动模式的特点与使用等,但是到底什么样子的场景,去使用什么样子的启动模式呢 Activit ...