string

i want to remove the integer from the string....

#include<iostream>
#include<string>

using namespace std;

int main(){
string name;
cout<<"Enter A String ";
getline(cin,name);

for(int i=0;i<name.size();i++){
if( name[i]!='0'||
name[i] !='1'||
name[i] !='2'||
name[i] !='3'||
name[i] !='4'||
name[i] !='5'||
name[i] !='6'||
name[i] !='7'||
name[i] !='8'||
name[i] !='9'){

}cout<<name[i];

}
}
Please edit your post and make sure your code is [code]between code tags[/code] so that it has syntax highlighting and line numbers, as well as proper indentation.

You meant to use && instead of ||. Even better, C++ guarantees that the numeric digits are guaranteed to be in order, so you can just use if(!(name[i] >= '0' && name[i] <= '9'))
Topic archived. No new replies allowed.