Beispiel struct

struct.cpp
#include <iostream>
#include <iomanip>
 
struct Anschrift
{
  char ort[40];
  int  plz;
};
 
int main()
{
  Anschrift x = { "Dresden", 1217 };
 
  // printf("%05d %s\n", x.plz, x.ort);  in C ...
 
  char oldfill = std::cout.fill();
  std::cout << std::setw(5) << std::setfill('0')
            << x.plz << ' ' << x.ort << '\n';
  std::cout.fill(oldfill);
}