#include <iostream>
using namespace std;

struct StreetAddress
{
    int house_number;
    string street_name;
};

void print_address(StreetAddress address, bool number_first)
{
    if (number_first)
    {
        cout << address.house_number << " " << address.street_name;
    }
    else
    {
        cout << address.street_name << " " << address.house_number;
    }
}

int main()
{
    StreetAddress white_house;
    white_house.house_number = 1600;
    white_house.street_name = "Pennsylvania Avenue";
    print_address(white_house, true);
    cout << endl << "Expected: 1600 Pennsylvania Avenue" << endl;
    StreetAddress train_station;
    train_station.house_number = 1;
    train_station.street_name = "Bahnhofstrasse";
    print_address(train_station, false);
    cout << endl << "Expected: Bahnhofstrasse 1" << endl;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: