Aug 25, 2012 at 8:23pm UTC
#include<iostream>
using namespace std;
struct Date
{
unsigned short day;
unsigned short month;
unsigned short year;
};
class list
{
private:
int size;
int len;
Date *my_array;
public:
list();
void copy(const list temp);
void clear();
void insert(Date d1, int n);
void remove(int r);
Date get(int n);
void update(Date d1,int n);
void find(Date d1);
int length();
void display();
};
list::list()
{
size=0;
len=0;
cin>>len;
int *my_array;
my_array= new int[len];
}
void list::insert(Date d1, int n)
{
for(int i=0;i<len;len++)
{
cin>>my_array[n].day;
cin>>my_array[n].month;
cin>>my_array[n].year;
}
}
void list::display()
{
for(int i=0;i<len;len++)
{
cout<<my_array[len].day;
cout<<my_array[len].month;
cout<<my_array[len].year;
}
}
void main()
{
list s;
Date d;
s.insert(Date d1, int n);
s.display();
system("pause");
}
Aug 25, 2012 at 8:42pm UTC
Poster not asking question properly and not telling us the error messages why?
Poster thinks we are psychic? Poster think we are magic?
Poster should post error messages. Poster should read error messages. Poster should look at the line the error messages tell him to:
s.insert(Date d1, int n);
and then poster will realise that this is wrong and poster meant to write
s.insert(d1, n);
and that poster has not given a value to n.
Last edited on Aug 25, 2012 at 8:46pm UTC
Aug 25, 2012 at 8:46pm UTC
RePost:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#include<iostream>
using namespace std;
struct Date
{
unsigned short day;
unsigned short month;
unsigned short year;
};
class list
{
private :
int size;
int len;
Date *my_array;
public :
list();
void copy(const list temp);
void clear();
void insert(Date d1, int n);
void remove(int r);
Date get(int n);
void update(Date d1,int n);
void find(Date d1);
int length();
void display();
};
list::list()
{
size=0;
len=0;
cin>>len;
int *my_array;
my_array= new int [len];
}
void list::insert(Date d1, int n)
{
for (int i=0;i<len;len++)
{
cin>>my_array[n].day;
cin>>my_array[n].month;
cin>>my_array[n].year;
}
}
void list::display()
{
for (int i=0;i<len;len++)
{
cout<<my_array[len].day;
cout<<my_array[len].month;
cout<<my_array[len].year;
}
}
void main()
{
list s;
Date d;
s.insert(Date d1, int n);
s.display();
system("pause" );
}
Please use code tags
Last edited on Aug 25, 2012 at 8:47pm UTC
Aug 25, 2012 at 9:43pm UTC
It's useless without indentation
Aug 26, 2012 at 6:44pm UTC
siir i have wirtten insert function to get values from user n dispay function to display these value but i dnt know how to cll them properly in main file
Aug 27, 2012 at 12:21am UTC
Have you tried declaring main as an int?