Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*by obernardovieira*/
- #include <iostream>
- #include <string>
- //#include <cctype>
- using namespace std;
- int main() {
- string myStr;
- cin >> myStr;
- if(myStr.find('.') != string::npos) {
- cout << "é um ponto flutuante"<<endl;
- }
- else {
- int l=0;
- int len;
- len=myStr.length();
- cout<<"largura "<<len<<endl;
- while(l<len) {
- if(myStr[l]<0x30||myStr[l]>0x39) {
- //if(!isdigit(myStr[l])) { //também funciona com a include cctype
- break;
- }
- l++;
- }
- if(l==len) {
- cout<<"é um numero"<<endl;
- }
- else {
- cout<<"é um frase"<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement