Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cctype>
- using namespace std;
- int main () {
- string userInput;
- float hasDigit = 1; //if has digit > 0 then the string has a digit
- int i;
- getline(cin, userInput);
- i = userInput.length();
- /*do {
- hasDigit = hasDigit * isdigit(userInput.at(i));
- i--;
- } while(i > 0);*/
- for (0; i < 0; --i) {
- hasDigit = hasDigit * isdigit(userInput.at(i));
- }
- if (hasDigit != 0) {
- cout << "yes" << endl;
- }
- else if (hasDigit == 0) {
- cout << "no" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement