美文网首页
判断数字位置

判断数字位置

作者: HelloSam | 来源:发表于2020-04-02 17:20 被阅读0次
图片.png
图片.png
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

int main()
{
    int m;
    cin >> m;
    string str;
    int counter;
    for (int i=0;i<m;i++)
    {
        counter = 1;
        cin >> str;
        for(string::iterator j=str.begin();j!=str.end();j++)
        {
            if (*j==48||*j==49||*j==50||*j==51||*j==52||*j==53||*j==54||*j==55||*j==56||*j==57)
            {
                cout << counter <<" ";
            }
            counter++;
        }
        cout <<endl;
    }
    return 0;
}

相关文章

网友评论

      本文标题:判断数字位置

      本文链接:https://www.haomeiwen.com/subject/kxtfphtx.html