#include <iostream>
#include <string>
#include <sstream>
using namespace std;

bool isnum(string s)
{
        stringstream sin(s);
        double t;
        char p;
        if(!(sin >> t))
                return false;
        if(sin >> p)
                return false;
        else
                return true;
}

int main()
{
        string s;
        while(cin >> s)
        {
                if(isnum(s))
                        cout << s << " is a number." << endl;
                else
                        cout << s << " is not a number." << endl;
        }
}
Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐