摩斯电码加密系统(也可解密)

//WARNING!THIS PROGRAM MAY HAVE ERROR!IF YOU FIND ERROR,PLEASE CALL H!e-mail:Caibohao0301@outlook.com/Caibohao0301@163.com/H20102020@outlook.com!
//server load page
//now all(4)server
//1.0server:start,time:1day,upload day:unkhown/unkhown/unkhown/unkhown:unkhown:unkhown(this server was delete,if you want to find older vertion,please search wechat record)
//1.1server:upload receive port(use new algorithm(before:check x[?](have error,classify on code,use if,ifelse,ifelseif),now:j-?,x[?](plus classify on code+length,use if,ifelse,ifelseif(less use)))),time:2hour,upload day:2022/6/3/21:50:00
//1.2server:upload receive port(use new algorithm(1.1ser:use x[?],1.2ser:use a,b,c,d,e,f))time:2hour,upload day:2022/6/10/22:23:00(clear any error on normal use(DO NOT USE THIS UNNORMAL,OR IT WILL BE IN A FOREVER-LOOP OR SOMETHING ERROR!)
//1.3server:upload send port(plus code to send to wechat or some thing web!)time:2hour,upload day:2022/6/12/15:46:00(now use on main)
#include<bits/stdc++.h>
using namespace std;
int mswechat() {
	char x;
	unsigned long long y;
	cout << "how many words you want to cout?" << endl;
	cin >> y;
	cout << "WARNING!IF YOU WANT TO PRINT'......',YOU HAVE TO PRINT'|'!" << endl;
	cout << "what to you want to compile?(includeing error(not in dictionary))" << endl;
	for (int i = 1; i <= y; i++) {
		cin >> x;//TODO
		if (x == 'a') {
			cout << ".-" << endl; //TODO
		} else if (x == 'b') {
			cout << "-..." << endl;
		} else if (x == 'c') {
			cout << "-.-." << endl;
		} else if (x == 'd') {
			cout << "-.." << endl;
		} else if (x == 'e') {
			cout << "." << endl;
		} else if (x == 'f') {
			cout << "..-." << endl;
		} else if (x == 'g') {
			cout << "--." << endl;
		} else if (x == 'h') {
			cout << "...." << endl;
		} else if (x == 'i') {
			cout << ".." << endl;
		} else if (x == 'j') {
			cout << ".---" << endl;
		} else if (x == 'k') {
			cout << "-.-" << endl;
		} else if (x == 'l') {
			cout << ".-.." << endl;
		} else if (x == 'm') {
			cout << "--" << endl;
		} else if (x == 'n') {
			cout << "-." << endl;
		} else if (x == 'o') {
			cout << "---" << endl;
		} else if (x == 'p') {
			cout << ".--." << endl;
		} else if (x == 'q') {
			cout << "--.-" << endl;
		} else if (x == 'r') {
			cout << ".-." << endl;
		} else if (x == 's') {
			cout << "..." << endl;
		} else if (x == 't') {
			cout << "-" << endl;
		} else if (x == 'u') {
			cout << "..-" << endl;
		} else if (x == 'v') {
			cout << "...-" << endl;
		} else if (x == 'w') {
			cout << ".--" << endl;
		} else if (x == 'x') {
			cout << "-..-" << endl;
		} else if (x == 'y') {
			cout << "-.--" << endl;
		} else if (x == 'z') {
			cout << "--.." << endl;
		} else if (x == '0') {
			cout << "-----" << endl;
		} else if (x == '1') {
			cout << ".----" << endl;
		} else if (x == '2') {
			cout << "..---" << endl;
		} else if (x == '3') {
			cout << "...--" << endl;
		} else if (x == '4') {
			cout << "....-" << endl;
		} else if (x == '5') {
			cout << "....." << endl;
		} else if (x == '6') {
			cout << "-...." << endl;
		} else if (x == '7') {
			cout << "--..." << endl;
		} else if (x == '8') {
			cout << "---.." << endl;
		} else if (x == '9') {
			cout << "----." << endl;
		} else if (x == '.') {
			cout << ".-.-.-" << endl;
		} else if (x == ',') {
			cout << "--..--" << endl;
		} else if (x == '!') {
			cout << "---..." << endl;
		} else if (x == '?') {
			cout << "..--.." << endl;
		} else if (x == '|') {
			cout << ".----." << endl;
		} else if (x == '-') {
			cout << "-....-" << endl;
		} else if (x == '(') {
			cout << "-.--." << endl;
		} else if (x == ')') {
			cout << "-.--.-" << endl;
		} else if (x == '/') {
			cout << "-..-." << endl;
		} else if (x == '=') {
			cout << "-...-" << endl;
		} else if (x == '+') {
			cout << ".-.-." << endl;
		} else if (x == '"') {
			cout << ".-..-." << endl;
		} else if (x == '*') {
			cout << "-..-" << endl;
		} else {
			cout << "error" << endl;
		}
	}
}
int ms() {
	char x;
	unsigned long long y;
	cout << "how many words you want to cout?" << endl;
	cin >> y;
	cout << "WARNING!IF YOU WANT TO PRINT'......',YOU HAVE TO PRINT'|'!" << endl;
	cout << "what to you want to compile?(includeing error(not in dictionary))" << endl;
	for (int i = 1; i <= y; i++) {
		cin >> x;//TODO
		if (x == 'a') {
			cout << ".-" << " "; //TODO
		} else if (x == 'b') {
			cout << "-..." << " ";
		} else if (x == 'c') {
			cout << "-.-." << " ";
		} else if (x == 'd') {
			cout << "-.." << " ";
		} else if (x == 'e') {
			cout << "." << " ";
		} else if (x == 'f') {
			cout << "..-." << " ";
		} else if (x == 'g') {
			cout << "--." << " ";
		} else if (x == 'h') {
			cout << "...." << " ";
		} else if (x == 'i') {
			cout << ".." << " ";
		} else if (x == 'j') {
			cout << ".---" << " ";
		} else if (x == 'k') {
			cout << "-.-" << " ";
		} else if (x == 'l') {
			cout << ".-.." << " ";
		} else if (x == 'm') {
			cout << "--" << " ";
		} else if (x == 'n') {
			cout << "-." << " ";
		} else if (x == 'o') {
			cout << "---" << " ";
		} else if (x == 'p') {
			cout << ".--." << " ";
		} else if (x == 'q') {
			cout << "--.-" << " ";
		} else if (x == 'r') {
			cout << ".-." << " ";
		} else if (x == 's') {
			cout << "..." << " ";
		} else if (x == 't') {
			cout << "-" << " ";
		} else if (x == 'u') {
			cout << "..-" << " ";
		} else if (x == 'v') {
			cout << "...-" << " ";
		} else if (x == 'w') {
			cout << ".--" << " ";
		} else if (x == 'x') {
			cout << "-..-" << " ";
		} else if (x == 'y') {
			cout << "-.--" << " ";
		} else if (x == 'z') {
			cout << "--.." << " ";
		} else if (x == '0') {
			cout << "-----" << " ";
		} else if (x == '1') {
			cout << ".----" << " ";
		} else if (x == '2') {
			cout << "..---" << " ";
		} else if (x == '3') {
			cout << "...--" << " ";
		} else if (x == '4') {
			cout << "....-" << " ";
		} else if (x == '5') {
			cout << "....." << " ";
		} else if (x == '6') {
			cout << "-...." << " ";
		} else if (x == '7') {
			cout << "--..." << " ";
		} else if (x == '8') {
			cout << "---.." << " ";
		} else if (x == '9') {
			cout << "----." << " ";
		} else if (x == '.') {
			cout << ".-.-.-" << " ";
		} else if (x == ',') {
			cout << "--..--" << " ";
		} else if (x == '!') {
			cout << "---..." << " ";
		} else if (x == '?') {
			cout << "..--.." << " ";
		} else if (x == '|') {
			cout << ".----." << " ";
		} else if (x == '-') {
			cout << "-....-" << " ";
		} else if (x == '(') {
			cout << "-.--." << " ";
		} else if (x == ')') {
			cout << "-.--.-" << " ";
		} else if (x == '/') {
			cout << "-..-." << " ";
		} else if (x == '=') {
			cout << "-...-" << " ";
		} else if (x == '+') {
			cout << ".-.-." << " ";
		} else if (x == '"') {
			cout << ".-..-." << " ";
		} else if (x == '*') {
			cout << "-..-" << " ";
		} else {
			cout << "error" << " ";
		}
	}
}
int mcout() {
	char a, b, c, d, e, f;
	int y;
	int z;
	cout << "how many codes you want to cout?" << endl;
	cin >> y;
	for (int i = 1; i <= y; i++) {
		cout << "the length of the code?" << endl;
		cin >> z;
		if (z > 6) {
			cout << "error" << endl; //TODO
		}
		if (z < 1) {
			cout << "error" << endl; //TODO
		}
		cout << "WARNING!COMPILE MUST USE SPACE IMMEDIATELY!" << endl;
		if (z == 1) {
			cin >> a;
			if (a == '.') {
				cout << "E" << endl; //TODO
			} else {
				cout << "T" << endl; //TODO
			}//TODO
		} else if (z == 2) { //aimn
			cin >> a >> b;
			if (a == '.') { //ai
				if (b == '-') {
					cout << "A" << endl; //TODO
				} else {
					cout << "I" << endl; //TODO
				}//TODO
			} else { //mn
				if (b == '-') {
					cout << "M" << endl; //TODO
				} else {
					cout << "N" << endl; //TODO
				}//TODO
			}//TODO
		}
		if (z == 3) { //dgkorsuw
			cin >> a >> b >> c;
			if (a == '.') { //rsuw
				if (b == '.') { //su
					if (c == '.') {
						cout << "S" << endl; //TODO
					} else {
						cout << "U" << endl; //TODO
					}//TODO
				} else { //rw
					if (c == '.') {
						cout << "R" << endl; //TODO
					} else {
						cout << "W" << endl; //TODO
					}//TODO
				}//TODO
			} else { //dgko
				if (b == '.') { //dk
					if (c == '.') {
						cout << "D" << endl; //TODO
					} else {
						cout << "K" << endl; //TODO
					}//TODO
				} else { //go
					if (c == '.') {
						cout << "G" << endl; //TODO
					} else {
						cout << "O" << endl; //TODO
					}//TODO
				}//TODO
			}//TODO
		} else if (z == 4) { //bcfhjlpqvxyz*
			cin >> a >> b >> c >> d;
			if (a == '.') { //jfhlpv
				if (b == '.') { //fhv
					if (c == '.') { //hv
						if (d == '.') {
							cout << "H" << endl; //TODO
						} else {
							cout << "V" << endl; //TODO
						}//TODO
					} else {
						cout << "F" << endl; //TODO
					}//TODO
				} else { //jlp
					if (c == '.') {
						cout << "L" << endl; //TODO
					} else {
						if (d == '.') {
							cout << "P" << endl; //TODO
						} else {
							cout << "J" << endl; //TODO
						}//TODO
					}//TODO
				}//TODO
			} else { //bcjqxyz*
				if (b == '.') { //bcxy*
					if (c == '.') { //bx*
						if (d == '.') {
							cout << "B" << endl; //TODO
						} else {
							cout << "X" << endl; //TODO
						}//TODO
					} else { //cy
						if (d == '.') {
							cout << "C" << endl; //TODO
						} else {
							cout << "Y" << endl; //TODO
						}//TODO
					}//TODO
				} else { //qz
					if (d == '.') {
						cout << "Z" << endl; //TODO
					} else {
						cout << "Q" << endl; //TODO
					}//TODO
				}//TODO
			}//TODO
		} else if (z == 5) { //1234567890(/=+
			cin >> a >> b >> c >> d >> e;
			if (a == '.') { //12345+
				if (b == '.') { //2345
					if (c == '.') { //345
						if (d == '.') { //45
							if (e == '.') {
								cout << 5 << endl; //TODO
							} else {
								cout << 4 << endl; //TODO
							}//TODO
						} else {
							cout << 3 << endl; //TODO
						}//TODO
					} else {
						cout << 2 << endl; //TODO
					}//TODO
				} else { //1+
					if (c == '.') {
						cout << "+" << endl;; //TODO
					} else {
						cout << 1 << endl; //TODO
					}
				}//TODO
			} else { //67890(/=
				if (b == '.') { //6(/=
					if (c == '.') { //6/=
						if (d == '.') { //6=
							if (e == '.') {
								cout << 6 << endl; //TODO
							} else {
								cout << "=" << endl; //TODO
							}//TODO
						} else {
							cout << "/" << endl; //TODO
						}//TODO
					} else {
						cout << "(" << endl; //TODO
					}//TODO
				} else { //7890
					if (c == '.') {
						cout << 7 << endl; //TODO
					} else {
						if (d == '.') {
							cout << 8 << endl; //TODO
						} else {
							if (e == '.') {
								cout << 9 << endl; //TODO
							} else {
								cout << 0 << endl; //TODO
							}//TODO
						}//TODO
					}//TODO
				}//TODO
			}//TODO
		} else if (z == 6) { //.,!?......-)"
			cin >> a >> b >> c >> d >> e >> f;
			if (a == '.') { //.?......"
				if (b == '.') {
					cout << "?" << endl; //TODO
				} else { //."......
					if (c == '.') { //."
						if (d == '.') {
							cout << '"' << endl;; //TODO
						} else {
							cout << "." << endl; //TODO
						}//TODO
					} else {
						cout << "......" << endl; //TODO
					}//TODO
				}//TODO
			} else { //,!-)
				if (b == '.') {
					if (c == '-') {
						cout << ")" << endl; //TODO
					} else {
						cout << "-" << endl; //TODO
					} //TODO
				} else {
					if (c == '.') {
						cout << "," << endl; //TODO
					} else {
						cout << "!" << endl; //TODO
					}//TODO
				}//TODO
			}//TODO
		} else {
			cout << "";
		}
	}
}
int main() {
	int ask;
	cout << "please input your ans(1-send,2-receive,3-wechat send,other-quit)" << endl;
	cin >> ask;
	if (ask == 1) {
		ms();//TODO
	} else if (ask == 2) {
		mcout();//TODO
	} else if (ask == 3) {
		mswechat();
	} else { 
		cout << "quit" << endl;
	}
	cout << "compile over";
}
//user manual(1.3ser)
//1:what is this program?
//	this is a program to send/compile morse-code.
//2:use
//2.1:first "cin"
//		first "cin" is doing for ask which mode you want to use.
//2.2:send
//		we will ask you how many code you want to send(if you write too much,system may cout error/compile over too early).
//		warning:this is a "unsigned-long-long mode",you can cin 0-18446744073709551615,
//		DO NOT CIN NUMBER BIGGER THAN 18446744073709551615 OR SMALLER THAN 0,DO NOT CIN
//		"float-mode(like:0.0,1.8......)",DO NOT CIN "char-mode(like:hello,?......)",
//		OTHER USE "int-mode",DO NOT CIN NUMBER BIGGER THAN 2147483647,SMALLER THAN
//		-2147483648!NITHER,YOU CAN NOT CIN "float-mode"OR"char-mode"!if it is char mode,
//		you can cin char,number(DO NOT CIN NUMBER BIGGER THAN 9 AND SMALLER THAN 0!).
//		you can cin some sentence and see/ctrl+c cout code!and wechat mode can plus enter!(we are so sorry that we did not record chinese)
//2.3:receive
//		we will ask you how many code you want to cin(if you write too much,system may cout error/compile over too early).
//		"int mode" user manual is in "send".when you want to cin code,please cin like that:
//		.-to. -or.+enter+-,we are checked if you cin on normal set there will be no problem!
//2.4:quit
//		if you cin a number apart from 1or2or3,we will end this program.
//3:tips
//	DO NOT CHANGE CODE IF YOU UNSAVE MAIN FILE OR YOU ARE NOT A PROGRAMMER!
//	IF THERE ARE ANY ERROR,PLEASE CALL:"Caibohao0301@outlook.com"(send in:24h,send receive:14h)/"Caibohao0301@163.com"(send in:24h,send receive:unkhown)
//	"H20102020@outlook.com"(send in:24h,send receive:14h)
//	if you receive this flie,please test that keys are right.net:https://www.qsl.net/bg3tt/zl/mesdm.htm
//4:flie creater:
//	1:programmer:H
//	2:ideas giver:H/Z
//	3:support:H/Z/Red Panda Dev-C++ 6.5/source forge/qsl.net(bg3tt)

这是我做的摩斯电码加密解密器,有3个功能。使用前要看说明书!!!

选自我的博客mscop1.3ser - 博客 - H的博客 (daimayuan.top)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值