class problem

create a class name address,
any public member can listed?
closed account (48T7M4Gy)
Yes
i need to implement class using address so far i created like this,what should i do next?

#include <iostream>
using namespace std;
class Address{

int houseno;
string street;
string city;
string state;
int postalcode;


};
int main()
{

return 0;
}
what should i do next?


Read this:
http://www.cplusplus.com/doc/tutorial/classes/
closed account (48T7M4Gy)
After reading you might like to build on this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <string>

class Address{
private:
	int houseNo;
	std::string streetName;
public:
	Address(int, std::string);
	void setStreetName(std::string aStreet);
	std::string getStreetName();
	int getHouseNo();
};

Address::Address(int aHouseNo = 16, std::string aStreetName = "Somewhere Road")
{
	houseNo = aHouseNo;
	streetName = aStreetName;
}

void Address::setStreetName(std::string aStreetName)
{
	streetName = aStreetName;
}

std::string Address::getStreetName()
{
	return streetName;
}

int Address::getHouseNo()
{ 
	return houseNo;
}

#include <iostream>

using std::string;
using std::cout;
using std::endl;

int main()
{
	Address myPile(15, "Main Road");
	cout << myPile.getHouseNo() << ' ' << myPile.getStreetName() << endl;

	Address somewhere;
	cout << somewhere.getHouseNo() << ' ' << somewhere.getStreetName() << endl;

	return 0;
}
Last edited on
why u delete my city and state?
closed account (48T7M4Gy)
why u delete my city and state?

u can fill in the rest
Topic archived. No new replies allowed.