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. 电脑清缓存(C盘占空间)

    电脑缓存目录: 1.取消文件隐藏 2.找到C:\Users\lwx351192\AppData\Local\Temp目录下的三个子文件夹local,locallow,roaming里面的文件都可删除, ...

  2. UVa 10537 The Toll! Revisited (最短路)

    题意:给定一个图,你要从 s 到达 t,当经过大写字母时,要交 ceil(x /20)的税,如果经过小写字母,那么交 1的税,问你到达 t 后还剩下 c 的,那么最少要带多少,并输出一个解,如果多个解 ...

  3. swift - 歌曲列表动画

    // //  ViewController.swift //  songAnimation // //  Created by su on 15/12/10. //  Copyright © 2015 ...

  4. JAVA反射机制o

    Reflection是Java 程序开发语言的特征之一,它允许运行中的 Java 程序对自身进行检查,或者说"自审",并能直接操作程序的内部属性.例如,使用它能获得 Java 类中 ...

  5. Android-快速查找索引篇

    01.Android-UI汇总 01.Android-TextView跑马灯效果 02.Android-Activity 01.Test 03.Android-数据存储 01.Test 04.Andr ...

  6. Github的注册经历

    姓名 韦军 学号 1413042023 班级 网络141 兴趣爱好 读书 上网 在注册Github时,先去网上下载了一个Github的app,打开一看全是英文,还是看懂了一些,点击开始注册,在注册时还 ...

  7. Java Web系列:Spring Security 基础

    Spring Security虽然比JAAS进步很大,但还是先天不足,达不到ASP.NET中的认证和授权的方便快捷.这里演示登录.注销.记住我的常规功能,认证上自定义提供程序避免对数据库的依赖,授权上 ...

  8. Mathout In Action(中文)

    http://download.csdn.net/detail/zxnm55/5593881

  9. 在jquery中怎么使用css类名和id来获取元素?

    在jquery中,你可以很容易的使用CSS类名和id类获取元素. 例如: 1.ID:#id $('#idA')——选择id为idA的所有元素,不管元素的标签名如何. $('div#idA')——选择i ...

  10. AndroidSDK下载

    C:\Windows\System32\drivers\etc\hosts74.125.237.1 dl-ssl.google.com