课程
{Main()
{
{
//一些代码
//some code
计划p =新计划();
Program p = new Program();
p.TranslateMorse();
p.TranslateMorse();
} public string TranslateMorse() { string input = Console.ReadLine(); string output = string.Empty; $ char [] splitInputString = input.Trim()。ToLower()。ToCharArray(); $ foreach(splInputString中的char c) { int index = Array.IndexOf(english,c); 输出+ =''+莫尔斯[指数]; } // string [] outputarray = new string [] {output}; using(System.IO.StreamWriter file = new System.IO.StreamWriter(path2,true) ) { file.WriteLine(输出); } //File.WriteAllLines(path2,outputarray); Console.WriteLine(输出); Console.ReadKey(false); } }
} public string TranslateMorse() { string input = Console.ReadLine(); string output = string.Empty; char[] splitInputString = input.Trim().ToLower().ToCharArray(); foreach (char c in splitInputString) { int index = Array.IndexOf(english, c); output += ' ' + morse[index]; } // string[] outputarray = new string[] { output }; using (System.IO.StreamWriter file = new System.IO.StreamWriter(path2, true)) { file.WriteLine(output); } //File.WriteAllLines(path2, outputarray); Console.WriteLine(output); Console.ReadKey(false); } }
}
}
您好,
i我试图将英文文本转换为莫尔斯代码。并编写了这种方法。
i am trying to convert english text to morse code. and have written this method.
但在编译此错误时显示ie; "修饰符public对此项目无效" 。
but when compiling this error is shown ie; "the modifier public is not valid for this item" .
我是编程和初学者无法解决这个问题..任何人都可以告诉我如何解决这个错误。
i'm a beginner in programming & couldnt solve this issue.. could any one pls tell me how to solve this error .
非常感谢,
many thanks,
推荐答案
将Main声明为
declare Main as static void Main()
更多推荐
修饰符public对此项无效
发布评论