Вот фрагмент моей функции getLength
Код: Выделить всё
int getLength() {
return length;
}
Код: Выделить всё
int main() {
Stack_str s;
string item;
string userInput;
while (true) {
// Prompt the user for input
cin >> userInput;
// Check if user wants to stop entering string input
if (userInput == "0") {
break; // Breaks from loop if user enters "0"
}
// Push the user input into the stack
s.push(userInput);
}
// Display stack
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78320071/adding-strings-to-a-stack-getting-incorrect-output[/url]