https://github.com/root-project/root
Raw File
Tip revision: 2cd3aafb76e161c5e687de877863ffeb4022b4b0 authored by Gerardo Ganis on 11 June 2012, 16:52:22 UTC
Import patch r44048 removing the automatic creation of TDrawFeedback in TProofChain
Tip revision: 2cd3aaf
Test1.cxx
/* -*- C++ -*- */
/*************************************************************************
 * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
 *
 * For the licensing terms see the file COPYING
 *
 ************************************************************************/
// Test1.cxx

#ifdef __hpux
#include <iostream.h>
#else
#include <iostream>
using namespace std;
#endif
#include "Complex.h"
#include "MyString.h"
#include "MyAlgo0.h"

int main()
{
  // instantiation of array or container
  const int ASIZE = 5;
  int      iary[ASIZE]; 
  Complex  cary[ASIZE];
  MyString sary[ASIZE];

  // assignment to container elements
  for(int i=0;i<ASIZE;i++) {
    iary[i] = i;
    cary[i] = Complex(i,i*2); // explicit type conversion
    sary[i] = i;         // implicit type conversion
  }

  // display container elements
  Disp(&iary[0],&iary[ASIZE]);
  Disp(&cary[0],&cary[ASIZE]);
  Disp(&sary[0],&sary[ASIZE]);

  // summation of container elements
  int      isum = Sum(&iary[0],&iary[ASIZE],0);
  Complex  csum = Sum(&cary[0],&cary[ASIZE],Complex());
  MyString ssum = Sum(&sary[0],&sary[ASIZE],MyString());

  cout << "isum=" << isum << endl;
  cout << "csum=" << csum << endl;
  cout << "ssum=" << ssum << endl;

  return(0);
} // automatic objects are automatically destoryed

back to top