All pastes #791728 Raw Edit

Something

public text v1 · immutable
·published 2007-11-21 01:24 UTC
rendered paste body
#include <iostream>
#include <string>

using namespace std;

class encoder{
	private:
		string encodestring, encoded;
		int cipher;
	public:
		encoder();
		void getencoder();
		void encode();
		void getcipher();
		void showcipher();
	
		string tehbets;
} encode;

encoder::encoder() {
	tehbets="abcdefghijklmnopqrstuvwxyz";
	cipher=1;
}
void encoder::getencoder() {
	char temp;
	cin >> temp;
	encodestring=temp;
}
void encoder::getcipher() {
	int temp;
	cin >> temp;
	cipher=temp;
	cipher=1;
}
void encoder::encode() {
	int temp, temp2;
	for(int i=0;i<encodestring.size();i++) {
		cout << i;
		temp2=i+cipher;
		temp=tehbets.find(encodestring[i]);
		encoded[i]=tehbets[temp2];
	}
	cout << encoded;
}
void encoder::showcipher() {
	cout << "\n" << cipher;
}

int choice() {
	string temp;string temp2="dDeEqQ";
	cout << "encode, decode or quit?";
	cin >> temp;
	if(!temp.empty()) {
		if(temp[0]==temp2[0]||temp[0]==temp2[1]) {
			return(1);
		} else if(temp[0]==temp2[2]||temp[0]==temp2[3]) {
			return(2);
		} else if(temp[0]==temp2[4]||temp[0]==temp2[5]) {
			return(0);
		}
	}
}

int main () {
	int temp;
	//encode.getencoder();
	temp=choice();
	if(temp==1) {
		
	} else if(temp==2) {
		cout << "string to encode: ";
		encode.getencoder();
		cout << "cipher shift: ";
		encode.getcipher();
		encode.encode();
		//encode.showcipher();
	}
	return 0;
}