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 求该边两顶点权值和除以 ...
随机推荐
- java 主类的main方法调用其他方法
方法1:A a=new test().new A(); 内部类对象通过外部类的实例对象调用其内部类构造方法产生,如下: public class test{ class A{ void fA(){ S ...
- 关于C语言中的Complex(复数类型)和imaginary(虚数类型)
关于C语言中的Complex(复数类型)和imaginary(虚数类型) 其实这里的复数complex就是数学里的复数,包含实部和虚部两个部分,比如:x=2.1+6i,下面进行详细介绍. C99 新增 ...
- 推送安霸A7L实时视频至RTMP服务器(1)
使用librtmp进行H264与AAC直播 (转:http://www.codeman.net/2014/01/439.html) 1.帧的划分 1.1 H.264帧 对于H.264而言每帧的界定符为 ...
- calico网络
内容请参考:http://www.cnblogs.com/CloudMan6/p/7509975.html
- jdb调试程序
1) jdb调试正在运行的进程: 先使用jps先确定进程号,然后让jdb连接上目标进程(23549换成实际的进程号): jdb -connect sun.jvm.hotspot.jdi.SAPIDAt ...
- SpringMVC源码解析- HandlerAdapter - ModelFactory
ModelFactory主要是两个职责: 1. 初始化model 2. 处理器执行后将modle中相应参数设置到SessionAttributes中 我们来看看具体的处理逻辑(直接充当分析目录): 1 ...
- SpringMVC源码解析 - HandlerAdater - ModelAndViewContainer上下文容器
HandlerAdapter在处理请求时上下文数据的传递工作是由ModelAndViewContainer负责的. 源码注释是这样描述的: Records model and view related ...
- pointcloud(点云)与mesh(面元)模型的区别
点元与面元
- CWnd::MoveWindow 详解
CWnd::MoveWindow void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE ); voi ...
- 第二周leetcode
4/4 这周莫名得忙,一天是做编译,一天是做模式识别作业,(一天刷魔兽皮肤),周末玩了两天,总的来说还是松懈了,大概只做了两天的leetcode,刷了10道题,羞愧羞愧. 决定每次把代码附上在这个总结 ...