141-21 guruh talabasi Xayrullayev Amirxon
Berilgan matnli fayldan simvollarni o‘qib, ekranga chiqaring va raqamlarni ajratib ko‘rsating.
#include
#include
using namespace std;
void extractIntegerWords(string str)
{
stringstream ss;
ss << str;
string temp;
int found;
while (!ss.eof()) {
ss >> temp;
if (stringstream(temp) >> found)
cout << found << " ";
temp = "";
}
}
int main()
{
string str = "1: 2 3 4 Amirxon";
extractIntegerWords(str);
return 0;
}
Do'stlaringiz bilan baham: |