help needed with code

micsom's Avatar, Join Date: Oct 2008
Go4Expert Member
friends..i am breaking my head from the morning over a little piece of code..

the requirement is ..if the input is "MIKE" will store the string as MIKE.*
if the input is "MIKE.TXT"(or any extension) will retain the filename with that extension..

please help me here
imrose_suleman's Avatar, Join Date: Oct 2008
Go4Expert Member
dude....its very easy thing dude ....y r u breaking ur head...
here is the code...
try this..

using namespace std;
string s;
cout<<"enter string"<<endl;
string s1=".*";
int count=0;
for(int i=0;i<s.length();i++)
if( count++;
if(count==0) s.insert(s.length(),s1);

Last edited by shabbir; 23Oct2008 at 18:30.. Reason: Code block