程序博客网 > 风云网络电视
来源:互联网 发布:风云网络电视 编辑:程序博客网 时间:2024/05/17 18:03
// 0938.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <string>#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){string str("ab2c3d7r4e6");string strNumber("0123456789");string::size_type pos = 0;while ( (pos = str.find_first_of(strNumber,pos)) != string::npos ){cout << "found number at index: " << pos << " element is " << str[pos] << endl;++pos;}return 0;}// 093802.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <string>#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){string str("ab2c3d7r4e6");string strNumber("0123456789");string::size_type pos = 0;while ( (pos = str.find_first_not_of(strNumber,pos)) != string::npos ){cout << "found number at index: " << pos << " element is " << str[pos] << endl;++pos;}return 0;}