# pragma once
#include
#include
#include
#include
#include
#includeusing namespace std;
The class Date {
Public:
Date ()=default;
The Date (string Date);
Void show_date () {
Cout}
Private:
Unsigned year=0;
Unsigned month=0;
Unsigned day=0;
VectorFormat_month {" Jan ", "Feb", "Mar", "Apr" and "May", "Jun", "Jul", "Aug", "Sept, Oct, Nov, Dec"};
};
Date: the Date (string Date) {
String number (" 0123456789 ");
//string comma (', ');
String slash ("/");
Int pos1=0;
Pos1=date. Find_first_of (slash, pos1);
String m=date substr (0 - pos1);
The month=stoi (m);
}
The definition of class, files in XXX. H
# include & lt; Iostream>
# include "chapter9. H"
using namespace std;
Int main () {
The Date the Date (" 1/1/1990 ");
Date. Show_date ();
return 0;
}
The main. The c class instantiation
G + + compiler error
CodePudding user response:
28 lines of code change: