Hey there im taking a intro course to c++ and we have a small assignment where we have the user input a string like:
He was 14 ten years ago. The next line should display just the numbers.
14.
i also know i have all the appropriate includes just need to know how to get the isdigit to check the string and pull the numbers for display.Code:int main() { char word[20]; int a; cout<<"Enter a sentence with at least one number in it."<<endl; cin.getline(word,20); for(word[20]) { if(!isdigit((unsigned char)word[20])>=0) { cout<<word<<endl; } } system("PAUSE"); }
thanks ahead of time.



LinkBack URL
About LinkBacks



