0
#include <iostream>
#include<string>
#include<vector>
using namespace std;


struct Names
{
    string fname;
    string lname;

void output()

{
    cout<<fname<<" "<<lname;

}

void input()
{
    cin>>fname>>lname;
}


};



struct birth_info
{
    int month;
    int day;
    int year;



    void input()

{
    cin>>month>>day>>year;

}

        void output()

{
    cout<<month<<"/"<<day<<"/"<<year;

}





};





    int main()
    {

        string name[3];
        int i;
        int day[3];
        int month[3];
        int year[3];



        Names names[3];
        birth_info birth[3];
        cout<<"Welcome to The Birthday Program v2"<<endl;


     for (int i=0;i<=2;i++)


     {
         cout<<"Enter First and Last Name"<<endl;
         names[i].input();

         cout<<"The Day"<<endl;
            cin>>day[i];

         cout<<"The Month"<<endl;
            cin>>month[i];

         cout<<"The Year"<<endl;
            cin>>year[i];

     }





           for(i=0;i<3;i++)
        {
                names[i].output();
                cout << ": ";
                birth[i].output();
                cout << endl;
        }


    vector <string> Gifts;

    Gifts.push_back("Guitar");
    Gifts.push_back("Gift Card");
    Gifts.push_back("Moviees");
    Gifts.push_back("books");
    Gifts.push_back("xbox");


int o;
cout <<"Gift Ideas: "<<endl;
for (o=0; o<Gifts.size(); o++)
cout << Gifts[o] << " " <<endl;
cout <<endl;





            return 0;
    }

ok so when i run the program the out put for the last array is supposed to output everyones birth day but it doesn't it outputs the variable addreses or something

any help would be helpfull

thanks#
2
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by deceptikon
0
#include <iostream>
#include<string>
#include<vector>
using namespace std;


struct Names
{
    string fname;
    string lname;

void output()

{
    cout<<fname<<" "<<lname;

}

void input()
{
    cin>>fname>>lname;
}


};



struct birth_info
{
    int month;
    int day;
    int year;



    void input()

{
    cin>>month>>day>>year;

}

        void output()

{
    cout<<month<<"/"<<day<<"/"<<year;

}





};





    int main()
    {

        string name[3];
        int i;
        int day[3];
        int month[3];
        int year[3];



        Names names[3];
        birth_info birth[3];
        cout<<"Welcome to The Birthday Program v2"<<endl;


     for (int i=0;i<3;i++)


     {
         cout<<"Enter First and Last Name"<<endl;
         names[i].input();

         cout<<"Enter The Day, the month and year"<<endl;
         cin>>birth[i].input();


     }





           for(i=0;i<3;i++)
        {
                names[i].output();
                cout << ": ";
                birth[i].output();
                cout << endl;
        }


    vector <string> Gifts;

    Gifts.push_back("Guitar");
    Gifts.push_back("Gift Card");
    Gifts.push_back("Moviees");
    Gifts.push_back("books");
    Gifts.push_back("xbox");


int o;
cout <<"Gift Ideas: "<<endl;
for (o=0; o<Gifts.size(); o++)
cout << Gifts[o] << " " <<endl;
cout <<endl;





            return 0;
    }

OK ichanged the code for the birth info but another error came up on the gift code

0

but another error came up

If you're going to paste over 100 lines of poorly formatted code with every post then I'll have to ask that you fix the formatting. If you're going to say vague things like "it doesn't work" or "I'm getting an error", I'll direct you here.

kthxbye.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.