string s1 = "10*100+20/2";
string[] s1_operand = s1.Split('*','+','-','/');
char[] s1_temp = s1.ToCharArray();
Stack<char> s1_operator = new Stack<char>();
for (int i = 0; i < s1_temp.Length; i++)
{
if (s1_temp[i] == '+' || s1_temp[i] == '-' || s1_temp[i] == '*' | s1_temp[i] == '/')
s1_operator.Push(s1_temp[i]);
}
foreach (char s in s1_operator)
{
Console.WriteLine(s);
}
string에서 숫자 한 자리면 몰라도
두 자리수 이상일 때 어떻게 쪼개야할지 진짜 모르겠어...
split('1' ....'0') 하면 숫자 하나식 쪼개질텐데
댓글 0