|
From: Brandan B. <bra...@gm...> - 2014-01-09 21:19:31
|
This is a pretty basic program and ive looked over it a bunch of times but
for some reason the command prompt comes out completely blank.
Composition.cpp
#include <iostream>
#include "Birthday.h"
#include "People.h"
using namespace std;
int main()
{
Birthday birthObj(11,21,1996);
People brandanBalasingham("Brandan", birthObj);
}
birthday.h
#ifndef BIRTHDAY_H
#define BIRTHDAY_H
class Birthday
{
public:
Birthday(int m, int d, int y);
void printDate();
private:
int month;
int day;
int year;
};
#endif // BIRTHDAY_H
birthday.cpp
#include "Birthday.h"
#include <iostream>
using namespace std;
Birthday::Birthday(int m, int d, int y)
{
month = m;
day = d;
year = y;
}
void Birthday::printDate()
{
cout << month << "/" << day << "/" << year << endl;
}
people.h
#ifndef PEOPLE_H
#define PEOPLE_H
#include <string>
#include "Birthday.h"
using namespace std;
class People
{
public:
People(string x, Birthday bo);
void printInfo();
protected:
private:
string name;
Birthday dateOfBirth;
};
#endif // PEOPLE_H
People.cpp
#include "People.h"
#include "Birthday.h"
#include <iostream>
using namespace std;
People::People(string x, Birthday bo)
: name(x), dateOfBirth(bo)
{
}
void People::printInfo()
{
cout << name << " born on ";
dateOfBirth.printDate();
}
|
|
From: Derek C. <de...@ci...> - 2014-01-10 01:19:12
|
You do realise that you have just defined the objects without calling
either print metnod?
On 9 January 2014 21:19, Brandan Balasingham <bra...@gm...> wrote:
> This is a pretty basic program and ive looked over it a bunch of times but
> for some reason the command prompt comes out completely blank.
>
>
> Composition.cpp
>
> #include <iostream>
> #include "Birthday.h"
> #include "People.h"
> using namespace std;
>
> int main()
> {
> Birthday birthObj(11,21,1996);
>
> People brandanBalasingham("Brandan", birthObj);
> }
>
>
> birthday.h
>
> #ifndef BIRTHDAY_H
> #define BIRTHDAY_H
>
>
> class Birthday
> {
> public:
> Birthday(int m, int d, int y);
> void printDate();
> private:
> int month;
> int day;
> int year;
> };
>
> #endif // BIRTHDAY_H
>
>
> birthday.cpp
>
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
>
> Birthday::Birthday(int m, int d, int y)
> {
> month = m;
> day = d;
> year = y;
> }
>
> void Birthday::printDate()
> {
> cout << month << "/" << day << "/" << year << endl;
> }
>
>
> people.h
>
> #ifndef PEOPLE_H
> #define PEOPLE_H
> #include <string>
> #include "Birthday.h"
> using namespace std;
>
> class People
> {
> public:
> People(string x, Birthday bo);
> void printInfo();
> protected:
> private:
> string name;
> Birthday dateOfBirth;
> };
>
> #endif // PEOPLE_H
>
>
> People.cpp
>
> #include "People.h"
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
> People::People(string x, Birthday bo)
> : name(x), dateOfBirth(bo)
> {
> }
>
> void People::printInfo()
> {
> cout << name << " born on ";
> dateOfBirth.printDate();
> }
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
|
|
From: Brandan B. <bra...@gm...> - 2014-01-10 20:15:18
|
Ok I called the objects but now it says that birthobj is undeclared and
class people has no member named print info
Updated Program:
Composition.cpp-
#include <iostream>
#include "Birthday.h"
#include "People.h"
using namespace std;
int main()
{
Birthday birthObj(11,21,1996);
People brandanBalasingham("Brandan", birthobj);
brandanBalasingham.printinfo();
}
birthday.h-
#ifndef BIRTHDAY_H
#define BIRTHDAY_H
class Birthday
{
public:
Birthday(int m, int d, int y);
void printDate();
private:
int month;
int day;
int year;
};
#endif // BIRTHDAY_H
birthday.cpp-
#include "Birthday.h"
#include <iostream>
using namespace std;
Birthday::Birthday(int m, int d, int y)
{
month = m;
day = d;
year = y;
}
void Birthday::printDate()
{
cout << month << "/" << day << "/" << year << endl;
}
people.h-
#ifndef PEOPLE_H
#define PEOPLE_H
#include <string>
#include "Birthday.h"
using namespace std;
class People
{
public:
People(string x, Birthday bo);
void printInfo();
protected:
private:
string name;
Birthday dateOfBirth;
};
#endif // PEOPLE_H
people.cpp-
#include "People.h"
#include "Birthday.h"
#include <iostream>
using namespace std;
People::People(string x, Birthday bo)
: name(x), dateOfBirth(bo) // name = x, dateOfBirth = bo
{
}
void People::printInfo()
{
cout << name << " was born on ";
dateOfBirth.printDate();
}
On Thu, Jan 9, 2014 at 4:19 PM, Brandan Balasingham
<bra...@gm...>wrote:
> This is a pretty basic program and ive looked over it a bunch of times but
> for some reason the command prompt comes out completely blank.
>
>
> Composition.cpp
>
> #include <iostream>
> #include "Birthday.h"
> #include "People.h"
> using namespace std;
>
> int main()
> {
> Birthday birthObj(11,21,1996);
>
> People brandanBalasingham("Brandan", birthObj);
> }
>
>
> birthday.h
>
> #ifndef BIRTHDAY_H
> #define BIRTHDAY_H
>
>
> class Birthday
> {
> public:
> Birthday(int m, int d, int y);
> void printDate();
> private:
> int month;
> int day;
> int year;
> };
>
> #endif // BIRTHDAY_H
>
>
> birthday.cpp
>
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
>
> Birthday::Birthday(int m, int d, int y)
> {
> month = m;
> day = d;
> year = y;
> }
>
> void Birthday::printDate()
> {
> cout << month << "/" << day << "/" << year << endl;
> }
>
>
> people.h
>
> #ifndef PEOPLE_H
> #define PEOPLE_H
> #include <string>
> #include "Birthday.h"
> using namespace std;
>
> class People
> {
> public:
> People(string x, Birthday bo);
> void printInfo();
> protected:
> private:
> string name;
> Birthday dateOfBirth;
> };
>
> #endif // PEOPLE_H
>
>
> People.cpp
>
> #include "People.h"
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
> People::People(string x, Birthday bo)
> : name(x), dateOfBirth(bo)
> {
> }
>
> void People::printInfo()
> {
> cout << name << " born on ";
> dateOfBirth.printDate();
> }
>
|
|
From: pwm <pw...@ia...> - 2014-01-12 04:12:48
|
Don't you think you should be a bit more careful and make sure you
differentiate between lowercase and uppercase letters?
birthObj and birthobj are not the same thing.
printinfo() and printInfo() are not the same thing...
/Per W
On Fri, 10 Jan 2014, Brandan Balasingham wrote:
> Ok I called the objects but now it says that birthobj is undeclared and class people has no member named print info
> Updated Program:
>
> Composition.cpp-
>
> #include <iostream>
> #include "Birthday.h"
> #include "People.h"
> using namespace std;
>
> int main()
> {
> Birthday birthObj(11,21,1996);
> People brandanBalasingham("Brandan", birthobj);
> brandanBalasingham.printinfo();
>
> }
>
>
> birthday.h-
> #ifndef BIRTHDAY_H
> #define BIRTHDAY_H
>
>
> class Birthday
> {
> public:
> Birthday(int m, int d, int y);
> void printDate();
> private:
> int month;
> int day;
> int year;
> };
>
> #endif // BIRTHDAY_H
>
>
> birthday.cpp-
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
> Birthday::Birthday(int m, int d, int y)
> {
> month = m;
> day = d;
> year = y;
> }
>
> void Birthday::printDate()
> {
> cout << month << "/" << day << "/" << year << endl;
> }
>
>
> people.h-
> #ifndef PEOPLE_H
> #define PEOPLE_H
> #include <string>
> #include "Birthday.h"
> using namespace std;
>
> class People
> {
> public:
> People(string x, Birthday bo);
> void printInfo();
> protected:
> private:
> string name;
> Birthday dateOfBirth;
> };
>
> #endif // PEOPLE_H
>
>
> people.cpp-
> #include "People.h"
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
> People::People(string x, Birthday bo)
> : name(x), dateOfBirth(bo) // name = x, dateOfBirth = bo
> {
> }
>
> void People::printInfo()
> {
> cout << name << " was born on ";
> dateOfBirth.printDate();
> }
>
>
>
> On Thu, Jan 9, 2014 at 4:19 PM, Brandan Balasingham <bra...@gm...> wrote:
> This is a pretty basic program and ive looked over it a bunch of times but for some reason the command prompt comes out completely blank.
>
> Composition.cpp
>
> #include <iostream>
> #include "Birthday.h"
> #include "People.h"
> using namespace std;
>
> int main()
> {
> Birthday birthObj(11,21,1996);
>
> People brandanBalasingham("Brandan", birthObj);
> }
>
>
> birthday.h
>
> #ifndef BIRTHDAY_H
> #define BIRTHDAY_H
>
>
> class Birthday
> {
> public:
> Birthday(int m, int d, int y);
> void printDate();
> private:
> int month;
> int day;
> int year;
> };
>
> #endif // BIRTHDAY_H
>
>
> birthday.cpp
>
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
>
> Birthday::Birthday(int m, int d, int y)
> {
> month = m;
> day = d;
> year = y;
> }
>
> void Birthday::printDate()
> {
> cout << month << "/" << day << "/" << year << endl;
> }
>
>
> people.h
>
> #ifndef PEOPLE_H
> #define PEOPLE_H
> #include <string>
> #include "Birthday.h"
> using namespace std;
>
> class People
> {
> public:
> People(string x, Birthday bo);
> void printInfo();
> protected:
> private:
> string name;
> Birthday dateOfBirth;
> };
>
> #endif // PEOPLE_H
>
>
> People.cpp
>
> #include "People.h"
> #include "Birthday.h"
> #include <iostream>
> using namespace std;
>
> People::People(string x, Birthday bo)
> : name(x), dateOfBirth(bo)
> {
> }
>
> void People::printInfo()
> {
> cout << name << " born on ";
> dateOfBirth.printDate();
> }
>
>
>
> |