simple Friends program
Why am I not getting any output for Customer Number, City, State, and Zip code?
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 51 52
|
#include<iostream>
#include <string>
using namespace std;
class City;
class Customer
{
private:
int customerNumber;
int zipcode;
public:
Customer(int number, int zip)
{
customerNumber = number;
zipcode = zip;
}
friend void display(Customer customer, City city);
};
class City
{
private:
string city;
string state;
public:
City(string C, string S)
{
city = C;
state = S;
}
friend void display(Customer customer, City city);
};
void display(Customer customer, City city)
{
cout << "Customer Number: " << endl;
cout << "City: " << endl;
cout << "State: " << endl;
cout << "Zip code: " << endl;
}
int main()
{
Customer customer(1234, 28054);
City city("Gastonia", "North Carolina");
display(customer, city);
return 0;
}
|
your program produces this output
Customer Number:
City:
State:
Zip code: |
¿were you expecting anything else?
the compiler cannot read minds.
Topic archived. No new replies allowed.