I've set myself the challenge of a RPN calculator. I have a list with the numbers used (in order) and another list with the operators used (in order, as chars). How can I create a function that will take the [0] from list1, take [0] from list2, then [1] from list1, then [1] from list2... but when taking a value from list2 as a char, converts it to an actual operator that can be used in calculations? - Thanks
static int cal()
{
string[] store = input.Split(' ');
List<int> num = new List<int>();
List<char> op = new List<char>();
foreach (string i in store)
{
if (Convert.ToInt32(i) / Convert.ToInt32(i) == 1)
{
num.Add(Convert.ToInt32(i));
}
else
{
op.Add(Convert.ToChar(i));
}
}
}