Example #1
0
File: flip.c Project: kapeterson/cs
int main() {
  int dim = 5, i;
//unsigned char arr[] = {0x00, 0xff, 0xff, 0xff, 0x00,
//                       0x00, 0x00, 0x00, 0xff, 0x00,
//                       0x00, 0xff, 0xff, 0xff, 0x00,
//                       0x00, 0x00, 0x00, 0xff, 0x00,
//                       0x00, 0xff, 0xff, 0xff, 0x00};
//					 
//  unsigned char arr[] = {0xff, 0xff, 0xff, 0xff, 0x00,
//                         0xff, 0xff, 0xff, 0xff, 0x00,
//                         0xff, 0xff, 0xff, 0xff, 0x00,
//                         0xff, 0xff, 0xff, 0xff, 0x00,
//                         0xff, 0xff, 0xff, 0xff, 0x00};
//
unsigned char arr[] = {0xff, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0xff, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0xff, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0xff, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0xff};
					 
  printf("Before flip:\n");
  print_2D(arr, dim);

  flip_horizontal(arr, dim);

  printf("After flip:\n");
  print_2D(arr, dim);

  return 0;
}
Example #2
0
 void HyperMatrix<T>::print_2D
 (const std::vector<int> & dimension, const std::string & file) const
 // Library facilities used: assert
 {
   ofstream out(file.c_str());
   print_2D(dimension, out);
   out.close();
 }