[Solved] Getting input from user till he enters a number

[ad_1]

Done!
Credit : @AlgirdasPreidžius

    #include <iostream>
    using namespace std;

    int fun() {
        string c;
        while(cin>>c) {
            if(isdigit(c[0]))
                return stoi(c);
        }
    }

    int main() {
        int a = fun();
        cout<<a<<" ";
        return 0;
    }

3

[ad_2]

solved Getting input from user till he enters a number