0

what is erorr here by c++ i want print time but he tells me erorr by visual studio

#include <ctime> #include <iostream> #include "stdafx.h". using namespace std; std::string months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; std::string days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; class Date { // Private Members private: std::string month; std::string day; int date; int year; // Public Members public: // Default Constructor Date() { const int BASE_YEAR = 1900; time_t timer; tm * time; std::time(&timer); time = localtime(&timer); date = time->tm_mday; month = months[time->tm_mon]; day = days[time->tm_wday]; year = time->tm_year + BASE_YEAR; } void printDate(void) { std::cout << "Current date " << this->month << " " << this->day << " " << this->date << " " << this->year; // Destructor } }; int main() { }

30th Aug 2017, 12:07 PM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar
4 Respostas
+ 10
i dont have social media. try creating a blank project and putting the code in again. You may have selected the wrong type of project in visual studio
30th Aug 2017, 12:34 PM
jay
jay - avatar
30th Aug 2017, 12:10 PM
jay
jay - avatar
+ 3
I'm not sure if this may help, but since you don't expect any argument passed into printDate maybe you can try to change printDate like: void printDate() instead of void printDate(void) As @Jay said, the code runs well in Code Playground, if there was an error you need to include the error description, including line number, so others who wanted to help can help you promptly.
30th Aug 2017, 1:16 PM
Ipang
+ 1
yes it said me error in visual studio can I give you my skype for help me
30th Aug 2017, 12:20 PM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar