当前位置: 首页>>代码示例>>C#>>正文


C# Keyword.GetOutput_Phrase方法代码示例

本文整理汇总了C#中Keyword.GetOutput_Phrase方法的典型用法代码示例。如果您正苦于以下问题:C# Keyword.GetOutput_Phrase方法的具体用法?C# Keyword.GetOutput_Phrase怎么用?C# Keyword.GetOutput_Phrase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Keyword的用法示例。


在下文中一共展示了Keyword.GetOutput_Phrase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

		public void Run() {
     	
         	Console.WriteLine("Available algorithms for encoding/decoding:");
			Console.WriteLine("1 - Vigenere Substitution.");
			Console.WriteLine("2 - Transposition Letter by Letter.");
			Console.WriteLine("3 - Phone Code.");
			Console.WriteLine("4 - Binary Code.");
			Console.WriteLine("5 - Keyword.");   
			Console.Write("\nType the algoritm #: ");
         	algoritm = Convert.ToInt32(Console.ReadLine());
			Console.Write("Type the phrase: ");
         	input_phrase = Console.ReadLine();
         	switch (algoritm) {
         		case 1:
					Console.WriteLine("\nVigenere Substitution.");
					Console.Write("Type the value: ");
         			value = Convert.ToInt32(Console.ReadLine());
         			if (value > 10 && value < 99) {
	         			Console.WriteLine("1 - Encode.");
	         			Console.WriteLine("2 - Decode.");
	         			Console.Write("Procedure #: ");
	         			procedure = Convert.ToInt32(Console.ReadLine());
	         			Vigenere_Substitution vs = new Vigenere_Substitution(input_phrase, value.ToString());
	         			switch (procedure) {
	         				case 1:
	         					vs.Encode();   
	         					Console.WriteLine("\n-- Successful encoding procedure --"); 
	         					Console.WriteLine("Original phrase: " + vs.GetInput_Phrase());
	         					Console.WriteLine("Encoded phrase: " + vs.GetOutput_Phrase());
	         					break;
	         				case 2:
	         					vs.Decode();
	         					Console.WriteLine("\n-- Successful encoding procedure --"); 
	         					Console.WriteLine("Original phrase: " + vs.GetInput_Phrase());
	         					Console.WriteLine("Decoded phrase: " + vs.GetOutput_Phrase());
	         					break;
	         				default:
	         					Console.WriteLine("\nNo option.");
	         					break;
	         			}	
	         			Console.Write("\nExport results? (Y/N) ");
	         			export = Console.ReadLine();
	         			switch (export[0]) {
	         				case 'Y':
								Console.Write("Type a name for the output file: ");
								file_name = Console.ReadLine();         				
	         					vs.Export(file_name);
	         					break;
	         				case 'N':         					
	         					break;
	         				default:
	         					Console.WriteLine("No option.");
	         					break;
	         			}
         			}
         			else {
         				Console.WriteLine("Invalid value.");
         			}
         			break;
         		case 2:
					Console.WriteLine("\nTransposition Letter by Letter.");
         			Console.WriteLine("1 - Encode phrase.");
         			Console.WriteLine("2 - Decode phrase.");
         			Console.Write("Procedure #: ");
         			procedure = Convert.ToInt32(Console.ReadLine());
         			Transposition t = new Transposition(input_phrase);
         			switch (procedure) {
         				case 1:
         					t.Encode();   
         					Console.WriteLine("\n-- Successful encoding procedure --"); 
         					Console.WriteLine("Original phrase: " + t.GetInput_Phrase());
         					Console.WriteLine("Encoded phrase: " + t.GetOutput_Phrase());
         					break;
         				case 2:
         					t.Decode();
         					Console.WriteLine("\n-- Successful encoding procedure --"); 
         					Console.WriteLine("Original phrase: " + t.GetInput_Phrase());
         					Console.WriteLine("Decoded phrase: " + t.GetOutput_Phrase());
         					break;
         				default:
         					Console.WriteLine("\nNo option.");
         					break;
         			}	
         			Console.Write("\nExport results? (Y/N) ");
         			export = Console.ReadLine();
         			switch (export[0]) {
         				case 'Y':
							Console.Write("Type a name for the output file: ");
							file_name = Console.ReadLine();         				
         					t.Export(file_name);
         					break;
         				case 'N':         					
         					break;
         				default:
         					Console.WriteLine("No option.");
         					break;
         			}
         			break;
         		case 3:
					Console.WriteLine("\nPhone Code.");
//.........这里部分代码省略.........
开发者ID:kedak007,项目名称:Encoder_Decoder,代码行数:101,代码来源:encoder_decoder.cs


注:本文中的Keyword.GetOutput_Phrase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。