Aug 26, 2013 at 3:44pm UTC
for example:
How many members? 2
name: edward
birthday (mm dd yyyy): 12 28 1994
name: eddy
birthday (mm dd yyyy): 12 28 1994
Enter date: 12 28 1994
edward
eddy
here's my code.
#include<iostream>
#include<conio.h>
#include<string.h>
using namespace std;
int inmonth, inday, inyear;
typedef struct
{
int month;
int day;
int year;
}
date;
typedef struct
{
char name[50];
date birth;
}
record;
void writeoutput(record member);
record readinput(int i);
main()
{
system("cls");
int i,n;
record member[100];
record readinput (int i);
void writeoutput(record member);
cout << "\t\t\n\n";
cout << "How many members?:\t";
cin >> n;
for (i=0;i<n; ++i)
{
member[i]= readinput(i);
}
for (i=0;i<n;++i)
writeoutput(member[i]);
return 0;
}
record readinput (int i)
{
record member;
cout <<"\nMember number: "<<i+1;
cout <<"\nName: ";
cin >> member.name;
cout<<"Birthday (mm dd yyyy): ";
cin >>member.birth.month>>member.birth.day>>member.birth.year;
return(member);
}
void writeoutput(record member)
{
cout <<"\n\n\nEnter date (mm dd yyyy):\t";
cin >>inmonth>>inday>>inyear;
if (inmonth==member.birth.month&&inday==member.birth.day&&inyear==member.birth.year)
cout <<"\nName: "<<member.name;
getch ();
return;
}
Last edited on Aug 30, 2013 at 1:48am UTC
Aug 26, 2013 at 5:26pm UTC
Do you want C++ help or C help? It looks like you're using a mix of both - choose one and stick with it.
Last edited on Aug 27, 2013 at 1:38pm UTC
Aug 29, 2013 at 3:17pm UTC
hey demandred. I'm sorry but I still cant get it. Can you add it to my code. Please. I'm really having a hard time getting this one done.
Aug 29, 2013 at 4:51pm UTC
#include<conio.h>
#include<string.h>
using namespace std;
int inmonth, inday, inyear;
typedef struct
{
int month;
int day;
int year;
}
date;
typedef struct
{
char name[50];
date birth;
}
record;
void writeoutput(record [],int);
record readinput(int i);
main()
{
system("cls");
int i,n;
record member[100];
cout << "How many members?:";
cin >> n;
for (i=0;i<n; ++i)
{
member[i]= readinput(i);
}
writeoutput(member,100);
getch();
return 0;
}
record readinput (int i)
{
record member;
cout <<"\nMember number: "<<i+1;
cout <<"\nName: ";
cin >> member.name;
cout<<"Birthday (mm dd yyyy): ";
cin >>member.birth.month>>member.birth.day>>member.birth.year;
return(member);
}
void writeoutput(record mem[],int size)
{
int count;
cout <<"\n\n\nEnter date (mm dd yyyy):\t";
cin >>inmonth>>inday>>inyear;
for(count =0;count<size;count++)
{
if (inmonth==mem[count].birth.month&&inday==mem[count].birth.day&&inyear==mem[count].birth.year)
cout <<"\nName: "<<mem[count].name;
}
}