// example4.cc
// CMSC15100-2
// Winter 2005
// structures

#include <iostream>

using namespace std;

// I'm defining the new type struct account
// outside of the main function
struct account {
  unsigned int number;
  float balance;
};

int main()
{
  // Declare variable of type struct account
  struct account bob;

  // set bob's information
  bob.number = 1234;
  bob.balance = 100.0;

  // fields may be used in expressions
  cout << "Bob has more than 200? " << (bob.balance > 200.0) << endl;

  cout << "Twice Bob's balance is " << (2.0 * bob.balance) << endl;

  // This isn't always true due to certain types not being able to
  // begin in the middle of a word on computer's memory
  cout << "How big is a struct account? " 
       << sizeof( struct account ) << endl;

  cout << "An int and a float are " << sizeof( int ) 
       << " and " << sizeof( float ) << endl;

  return 0;
}
