I would like to know how to call the methods of the class.
I have an object call v which is an array and I don't how to call the methods
of the class. The error is here:
v.readDates(v[a]);
Thank you.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "Date.h"
#include <iostream>
usingnamespace std;
int main(){
int a;
cout << " HOW MANY DATES DO YOU HAVE? " << endl;
cin >> a;
Date v[a];
v.readDates(v[a]);
v.sortDates(v[a]);
v.showDates (v[a]);
return 0;
}
YES OF COURSE: The number format is:
YYYYMMDD EXAMPLE:
20141130
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void Data::readDates(Data [num]){
int a_date;
for (int i=0;i<num;i++){
cout << "ENTER A DATE:" << endl;
cin >> a_date;
int day=v[i].days(a_date);
int year=v[i].years(a_date);
int month=v[i].months(a_date);
while (!esValida(any,mes,dia)){
cin >> a_date;
day=v[i].days(a_date);
year=v[i].years(a_date);
month=v[i].months(a_date);
}
}
}