Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Visual C# 使用 Stack 编写 RPN 计算器。问题是我不知道该怎么做。我正在使用 System.Collections.Generic,但是
Stack<double> s = new Stack<double>();
产生错误:
使用泛型类型“System.Collections.Generic.Stack”需要“1”类型参数
我在这里很无知。谢谢您的帮助。
尝试这个
Stack<int> s = new Stack<int>();
将 int 替换为您存储在堆栈中的任何类型。
您需要指定将存储在堆栈中的元素的类型,例如整数堆栈: