topical media & game development

talk show tell print

basic-program-solutions-07-Soln7-1.c

? / basic-program-solutions-07-Soln7-1.c


  // Soln7_1.cpp
  
  include <iostream>                   // For stream input/output
  
  using std::cout;
  using std::endl;
  
  struct Sample
  {
     int one;
     int two;
  };
  
  int main()
  {
     Sample a;
     Sample b;
  
     a.one = 1;
     a.two = 2;
     b.one = b.two = 9999;
  
     cout << "a=(" << a.one << "," << a.two << ")" << endl;
  
     // b contains values 9999
     cout << "b=(" << b.one << "," << b.two << ")" << endl;
  
     b = a;
     cout << "After assigning a to b:" << endl;
     cout << "b=(" << b.one << "," << b.two << ")" << endl;
  
     return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.