#include <iostream>
#include <ctype.h>
using namespace std;
int main()
{
string s;
cout << "Введите строку: ";
cin >> s;
string n = "";
for (int i = 0; i < s.length(); i++)
if (isdigit(s[i]))
n += s[i];
cout << n;
return 0;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
#include <ctype.h>
using namespace std;
int main()
{
string s;
cout << "Введите строку: ";
cin >> s;
string n = "";
for (int i = 0; i < s.length(); i++)
if (isdigit(s[i]))
n += s[i];
cout << n;
return 0;
}