#include<iostream>
#include<string>
#include <cstdlib>
#include<cctype>
#include<stdexcept>
#include<algorithm>
#include<vector>
#include<map>
#include "code.h"
using namespace std;

int main()
{
	srand(time(NULL));
	Code c;
	if(!c.load("ABC","def"))
		cout<<"\nOops";
	c.show();
	cout<<endl<<"The number of characters encoded is "<<c.code_size();
	cout<<c.apply("\nAll cool.\n");
	if(c.encryptable("All cool."))
		cout<<"That was supposedly encryptable."<<endl;
	else
		cout<<"That was supposedly un-encryptable."<<endl;
	c.change('a','e');
	c.show();
	cout<<endl;
	c.unload("bc");
	cout<<endl<<"The number of characters encoded is "<<c.code_size();
	cout<<endl;
	c.show();
	cout<<endl;
	cout<<"Test 'random'.\n";
	c.random();
	c.show();
	cout<<endl<<"The number of characters encoded is "<<c.code_size();
	cout<<endl;
	if(c.encryptable("All cool."))
		cout<<"That was supposedly encryptable."<<endl;
	string s=c.apply("Hi, how is this?");
	cout<<s;
	c.invert();
	cout<<endl<<c.apply(s);
		
	return 0;
}
				
			
			
			
				
				

				
				
		
