Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string s;
- getline(cin, s);
- int cnt = 0;
- for (int i = 0; i < int(s.size()); i++)
- {
- if (s[i] == '.')
- {
- cnt++;
- }
- else if (!isdigit(s[i]))
- {
- cout << "Bad string" << endl;
- return 0;
- }
- }
- if (cnt > 1)
- {
- cout << "Bad string: too many dots" << endl;
- return 0;
- }
- cout<<"It seems that string is good :-)" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment