Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<string> n_and_o(string cad)
- {
- List<string> list = new List<string>();
- for (int i = 0; i < cad.Length; i++)
- {
- if (cad[i] == '+')
- {
- list.Add("suma");
- }
- if (cad[i] == '-')
- {
- list.Add("resta");
- }
- if (cad[i] == '*')
- {
- list.Add("multi");
- }
- if (cad[i] == '/')
- {
- list.Add("div");
- }
- }
- return list;
- }
- List<int> n_and_o_1(string cad)
- {
- List<int> nums = new List<int>();
- foreach(var x in cad.Replace('+', ' ').Replace('-', ' ').Replace('*', ' ').Replace('/', ' ').Split())
- {
- nums.Add(Convert.ToInt32(x));
- Console.WriteLine(x);
- }
- return nums;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement