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. HttpClient详解

    HttpClient:是一个接口 首先需要先创建一个DefaultHttpClient的实例 HttpClient httpClient=new DefaultHttpClient(); 发送GET请 ...

  2. php识别二维码

    php-zbarcode 是 PHP 读取条形码的扩展模块,目前仅支持 php5.x

  3. MongoDB管理与开发实战详解文摘

    第1篇 基础篇 第1章 MongoDB简介 关系型数据库面临的问题:数据库并发负载高,海量数据存储与访问,数据库数据越来越大,事务管理的负担,关系型数据库读.写实时性的忽略,多表关联查询被弱化 第2章 ...

  4. tab切换代码优化

    上次的tab切换的代码里面有很多重复的代码,需要做做优化,把重复的代码用函数封装起来调用. 优化前: <script> //获取id封装成一个函数$()方便调用 function $(id ...

  5. Jdom简单的修改xml文件实现

    上一篇博客写到在打开outputStream 时总是报错,而且出现jdom有问题,后来注意到junit提示的一个错误:文件过早关闭. 顾名思义:用getResorceAsStream打开了文件作为输入 ...

  6. util:properties

    示例 <util:properties id="db" location="classpath:db.properties" /> 全部属性 功能概 ...

  7. RocketMQ 加载配置文件

    BrokerStartup.java // 指定配置文件 if (commandLine.hasOption('c')) { String file = commandLine.getOptionVa ...

  8. task:scheduled cron 合法

    http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html task:scheduled o ...

  9. 程序员不常用Linux命令集

    1) 关闭指定网卡,如关闭网卡eth0 ifconfig eth0 down 也可以使用ifdown,通常ifdown是一个指向ifup的软链接,而ifup为一个脚本文件. 2) 命令自启动,如希望机 ...

  10. Area Learning

    Area Learning区域学习 How it works它是如何工作的 With Motion Tracking alone, the device tracks its movement and ...