[ create a new paste ] login | about

Link: http://codepad.org/SfrHkgtC    [ raw code | output | fork ]

outoftime - C++, pasted on Dec 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

bool Re(char s){return (isdigit(s) || s == '.');}

string R(string s){return (int(count_if(s.begin(),s.end(),Re)) == int(s.size())) ? ("Yes") : ("No");}

int main()
{
    cout << (R("2366687")) << endl << (R("hg5456")) << endl << (R("54f56")) << endl << (R("5.456")) << endl;
    return 0;
}


Output:
1
2
3
4
Yes
No
No
Yes


Create a new paste based on this one


Comments: