Sorry I'm awful at programming and need so help so I can move on with my other tasks. This is my program below:
#include<iostream> #include"date.h" #include<string> using namespace std; int main() { //string thurs; Date myDate(thurs,12,2014); cout<<"Day is: "<<myDate.getDay()<<endl; cout<<"month is: "<<myDate.getMonth()<<endl; cout<<"month is: "<<myDate.getYear()<<endl; } Where is says "thurs" it says it is undeclared, I tried to declare it but it still didn't fix my problem, its why I commented it out.
This is my class, Im not sure if this is the problem:
#include<iostream> using namespace std; class Date { private: string day; int month; int year; public: Date(string day,int month,int year); //Param Constructor void setDay(string); void setMonth(int); void setYear(int); string getDay(); int getMonth(); int getYear(); }; and finally my Setters/Getters, not sure if this might be the problem:
#include"date.h" Date::Date(string day,int month, int year) { this->day=day; this->month=month; this->year=year; } //getters string Date::getDay() { return day; } int Date::getMonth() { return month; } int Date::getYear() { return year; } //Setters void Date::setDay(string d) { day=d; } void Date::setMonth(int m) { month=m; } void Date::setYear(int y) { year=y; } At the moment it displays everything apart from "thurs" - any help and sorry for horrible layout >.<
thursand not"thurs"?