Charles V. Schaefer, Jr. School of Engineering and Science
 
 
SES Home » Science Departments » Algebraic Cryptography Center » Software

Software

The CRAG Software Library FAQ

// Copyright (C) 2005 Aleksey Myasnikov
// Contents: Example for class FiniteAlphabet
//
// Principal Authors: Aleksey Myasnikov
//
// Revision History:
//

#include "Alphabet.h"
#include "Word.h"
#include 

int main( )
{
  int R = 3;

 
// How do I create a finite alphabet of size R
  FiniteAlphabet A1( R );

 
// How do I create a free group from a list of letters
  vector letters(R);
  cout << " Enter " << R << " letters : " << flush;  
  for (int i=0;i> letters[i];
  
  FiniteAlphabet A2( letters );
  
 
// How do I print an alphabet
  cout << A2 << endl;

 
// How do I input an alphabet from a stream
  cout << "Enter a finite alphabet (Example: {a,b,c,d}) : "; cin >> A1;
  cout << A1 << endl;
  

 
// How do I input a word in the alphabet
  cout << "Input a word in " << A1 << " ending with ';' " <<  flush;
  Word w1 = A1.readWord( cin );

 
// How do I print word in letters of the alphabet
  A1.printWord( cout, w1 ); cout << endl;


  
 
// How do I input a vector of words in the alphabet
  cout << "Input a vector of words in " << A1 << " Example : { a^2 b , a b } " <<  flush;
  vector v1 = A1.readVector( cin );

 
// How do I print a vector of words in letters of the alphabet
  A1.printVector( cout, v1 ); cout << endl;

  
  return 0;
}