Home Segments Index Top Previous Next

443: Mainline

You could write a simple program to translate the numbers:

#include  
main ( ) { 
  int type_code; 
  while (cin >> type_code) 
    if (type_code == 0)        cout << "eng" << endl; 
    else if (type_code == 1)   cout << "box" << endl; 
    else if (type_code == 2)   cout << "tnk" << endl; 
    else if (type_code == 3)   cout << "cab" << endl; 
} 

Such a program is called an iterative filter, because it can be used to transform a data stream into a new data stream.