kao shi
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的更多相关文章
- kao shi di er ti(还没有订正)
// 离散化点 思路应该是对的 吧 但没时间去检查编译上的错误 #include <bits/stdc++.h> using namespace std; ; #define ri reg ...
- dwr消息推送和tomcat集群
网友的提问: 项目中用到了dwr消息推送.而服务端是通过一个http请求后 触发dwr中的推送方法.而单个tomcat中.服务器发送的http请求和用户都在一个tomcat服务器中.这样就能精准推送到 ...
- 【Gym 100733D】Little thief Shi
题 Shi realized that he was almost out of money, even renting Shitalian lands. Shi was walking on a s ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 【最小生成树】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 ...
- Qin Shi Huang's National Road System HDU - 4081(树形dp+最小生成树)
Qin Shi Huang's National Road System HDU - 4081 感觉这道题和hdu4756很像... 求最小生成树里面删去一边E1 再加一边E2 求该边两顶点权值和除以 ...
随机推荐
- 我所理解的 PHP Trait
Trait 是从 PHP 5.4 加入的一种细粒度代码复用的语法.以下是官方手册对 Trait 的描述: Trait 是为类似 PHP 的单继承语言而准备的一种代码复用机制.Trait 为了减少单继承 ...
- hrabs 首页 新闻,快捷菜单,响应式列表,seliverlight
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="firstPage.aspx ...
- An interview question from MicroStrategy
去年校招时的一道面试题,觉得蛮有意思,贴出来. Question: Spy start at a, during an interval he moves |b| to right when b &g ...
- android 的AlertDialog对话框
private int selectedFruitIndex = 0; private void showMsg2() {// Dialog alertDialog = new AlertDial ...
- 一起做RGB-D SLAM (6)
第六讲 图优化工具g2o的入门 2016.11 更新 把原文的SIFT替换成了ORB,这样你可以在没有nonfree模块下使用本程序了. OpenCV可以使用 apt-get install libo ...
- 8 种提升 ASP.NET Web API 性能的方法 (转)
出处:http://www.oschina.net/translate/8-ways-improve-asp-net-web-api-performance ASP.NET Web API 是非常棒的 ...
- Net下的 ORM框架介紹(转)
http://www.cnblogs.com/zhaoyx/articles/1896638.html 在.NET平台下,关于数据持久层框架非常多,本文主要对如下几种做简要的介绍并推荐一些学习的资源: ...
- python3 二叉树的存储和三种遍历
#coding:utf-8 class node(): def __init__(self,k=None,l=None,r=None): self.key=k; self.left=l; self.r ...
- 基于Extjs的web表单设计器
由于这样工作和自身的一些原因很长一段时间没有写过博客了.最近想把自己前面一段时间搞出的一个表单设计器的相关经验或者经历记录下来.分享给大家,也算是对自己前2个月的一个总结回顾吧. 首先介绍一下开发此版 ...
- Javascript设计模式理论与实战:工厂方法模式
本文从简单工厂模式的缺点说起,引入工厂方法模式,介绍的工厂方法模式的基本知识,实现要点和应用场景,最后举例进行说明工厂方法模式的应用.在之前的<Javascript设计模式理论与实战:简单工厂模 ...