小编LSa*_*age的帖子

在字符串之前预期')'

我已经为这个问题尝试了很多不同的解决方案,我似乎无法弄清楚为什么编译器继续在我的头文件中给我这个错误.如果有人能给我一些见解,那将非常感激.编辑:抱歉忘了哪一行给出错误.它在头文件中的行:Date(string mstr,int dd,int yy);

是的,我知道这个=新的日期...是一个糟糕的解决方案,我只是稍微研究一下;)

标题:

#include <string>

#ifndef DATE_H
#define DATE_H

class Date{
    public:
        Date(int mm, int dd, int yy);
        Date(string mstr, int dd, int yy);
        void print();
        void printFullDate();
        void prompt();

        void setMonth(int);
        void setDay(int);
        void setYear(int);

        int getMonth();
        int getDay();
        int getYear();

        static const int monthsPerYear = 12;
    private:
        int month;
        int day;
        int year;

        int checkDay(int);
};

#endif
Run Code Online (Sandbox Code Playgroud)

如果你需要它,这是实现(它还没有完全完成,我只是试图测试我写的一些函数):

#include <iostream>
#include <stdexcept>
#include "Date.h"
using namespace std;

Date::Date(int mm, int dd, int yy){
    setMonth(mm);
    setYear(yy); …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors codeblocks

0
推荐指数
1
解决办法
2971
查看次数

标签 统计

c++ ×1

codeblocks ×1

compiler-errors ×1