Hello !!!

i'm having difficulties linking a header files and source files. When I
want to compile a program I type this:

#g++ 11.3.cpp Person.h -o bla
g++: Compilation of header file requested

# ls -lsaF bla
ls: bla: No such file or directory

How come that there's no executable? Here are my header and source files.

#############
Person.h
#############

#ifndef PERSON_H
#define PARSON_H
#include <iostream.h>
using namespace std;

struct Name
{
        char firstname[80];
        char surname[80];

        void show()
        {
                cout << firstname << " " << surname;
        }
};

struct Date
{
        int day;
        int month;
        int year;

        void show()
        {
                cout << month << "/" << day << "/" << year;
        }
};

struct Phone
{
        int areacode;
        int number;

        void show()
        {
                cout << areacode << " " << number;
        }
};

struct Person
{
        Name name;
        Date birthdate;
        Phone number;

        void show()
        {
                cout << endl;
                name.show();
                cout << endl;
                cout << "Born: ";
                birthdate.show();
                cout << endl;
                cout << "Telephone: ";
                number.show();
                cout << endl;
        }

        int age(Date& date)
        {
                if(date.year <= birthdate.year)
                        return 0;

                int years = date.year - birthdate.year;

                if((date.month > birthdate.month) || (date.month ==
birthdate.m
                        return years;
                else
                        return --years;
        }
};
#endif

#############
11.3.cpp
#############

#include <iostream.h>
using namespace std;
#include "Person.h"

int main()
{
        Person her = {
                        { "Letitia", "Gruntfuttock" },
                        { 1, 4, 1965                },
                        { 212, 5551234              }
                     };

        Person actress;
        actress = her;
        her.show();

        Date today = { 24, 3, 1999 };

        cout << endl << "Today is ";
        today.show();

        cout << endl;

        cout << "Today " << actress.name.firstname << " is "
             << actress.age(today) << " years old."
             << endl;

        return 0;
}

                       
                                                                Bye.
                                
                                  //////
                                 ( o o )
               /------------oOO-----O-----OOo------------\
               |           From: Iztok Polanic           |
               |         E-mail: [EMAIL PROTECTED]         |
               |        WWW: http://come.to/kotzi        |
               \-----------------------------------------/             
         
                     

Reply via email to