如何纠正我的程序并使它显示预期的初始时间

时间:2018-11-07 20:32:04

标签: c++

我正在尝试编写将时间设置为11/7/2018的程序,但是它不起作用。它仅显示4个错误。有人可以帮我纠正代码。

def update_data_plot(attrname, old, new):
    new_value = dropdown.value
    # here make something that you can pass to construct a new ColumnDatasource with the new value
    # and put it into a variable called newdata
    source.data = ColumnDataSource(data=newdata).data

它在成员函数#include <iostream> using namespace std; class date { private: int day,month,year; public: void advance(); date(){ day=1; month=1; year=2018; }; void setDate(){ cout<<day<<"/"<<month<<"/"<<year<<endl; } }; void date::advance(){ for(month=1;month=<12;month++){ for(day=1;day=<31;day++){ cout<<day<<"/"<<month<<"/"<<year<<endl; } } } int main(){ date d; cout<<"Date set as:"; d.setDate(); cout<<"Setting the advance method"<<endl; d.advance(); return 0; } 中显示:

void date::setDate()

1 个答案:

答案 0 :(得分:1)

我认为您打算写

cout<<day<<"/"<<month<<"/"<<year<<endl;

代替

cout<<date<<"/"<<month<<"/"<<year<<endl;

在setDate和Advance函数中