https://pastein.ru/t/UK

  скопируйте уникальную ссылку для отправки


#include <iostream>
#include <string>

using namespace std;

int main()
{
	setlocale(LC_ALL, "Russian");
	int max = -1;
	int current;
	string input;
	string temp = "";
	cout << "Введите строку: ";
	cin >> input;
	for (int i = 0; i <= input.length(); i++)
	{
		if (isdigit(input[i]))
		{
			temp += input[i];
		}
		else
		{
			if (!temp.empty())
			{
				current = stoi(temp);
				temp = "";
				if (current > max)
				{
					max = current;
				}
			}
		}
	}
	cout << "\nМаксимальное число из строки:" << max;
}