Get premium membership and access questions with answers, video lessons as well as revision papers.

Create a class in C++ language that holds name and address information.Store all the information in character strings that are private members of the class.Include...

      

Create a class in C++ language that holds name and address information.Store all the information in character strings that are private members of the class.Include a public function that stores the name and address.Also include a public function that displays the name and address. (Call these functions store() and display() )

  

Answers


Davis
#include
#include
using namespace std;
class addr {
char name [40];
char street [40];
char city [30];
char state [3];
char zip [10];
public:
void store (char *n, char *s, char *c, char *t, char *z);
void display();
};
void addr :: store (char *n, char *s, char *c, char *t, char *z)
{
strcpy (name, );
strcpy (street, s);
strcpy (city, c);
strcpy (state, t);
strcpy (zip, z);
}
void addr ::display()
{
cout << name << "\n";
cout << street << "\n";
cout << city << "\n";
cout << state << "n";
cout << zip << "\n\n";
}
int main ()
{
addr a;
a.store( "C. B Turkel", "11 Pinetree Lane", "Wausau",
"In", "46576");
a.display();
return 0;
Githiari answered the question on May 5, 2018 at 17:42


Next: Write a program that uses C++ style I/O to prompt the user for a string and then display its length.
Previous: Create an overload rotate() function using C++ new style that left-rotates the bits in its argument and returns the result.Overload it so it accepts ints...

View More Computer Science Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions