|
#1
|
|||
|
|||
|
how to write this program in c++?
hello, i need ur help..
at least i need to know how to begin with it. define a CLASS PERSON TYPE that does: a. set the first name only. b. set the last name only. c. store and set the middle name. d. check whether a given first name is the same as the first name of this person. e.check whether a given first name is the same as the first name of this person, write the definition of the member function to implement the operations for this class.also, write a program to test various operations on this class. |
|
#2
|
|||
|
|||
|
Simply think in terms of objects that have "state" and "behavior"
- What is the relevant state of a Person in your problem? - What behavior does your person have? |
|
#3
|
||||
|
||||
|
Here is a beginning:
Code:
#include <iostream>
#include <string>
using namespace std;
class PERSON
{
private:
string firstname;
public:
void setFirstname();
};
void main()
{
PERSON object;
object.setFirstname();
}
void PERSON::setFirstname()
{
cout << "Give firstname" << endl;
cin >> firstname;
}
__________________
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Closed program stays running in RAM | DGardner37 | .NET | 7 | 12-03-2008 10:34 AM |
| help write screen saver program in VS.Net that shows computer playing ping pong | irinka1978 | .NET | 4 | 09-24-2008 09:57 AM |
| Help with Server program | sedricbenson@ho | C++ | 2 | 11-07-2006 09:18 AM |
| Help! Write a program to compute easter sunday | t0n3dawgg | Java | 2 | 10-10-2006 02:03 AM |
| Help with a program | stormswimmer | Java | 2 | 01-02-2006 04:17 PM |