Programming Help

I am having trouble with this in C++
Code:
  while(k < bodyCopy.size())
    {
      bodyCopy[k] = tolower(bodyCopy[k]);
      please=bodyCopy[k];
      cout<<please<<endl;
      if (please='<')
      {
           inTag=1;
      }
      if (inTag==1)
      {
           please='.';
           bodyCopy[k]=please;
      }
              
      if (please=='>')
      {
           inTag=0;
      }         
                                 
      
      
      k = k + 1;
    }
Its supose to replace any thing in string body.Copy between < > with periods but leave everything else alone
currently it changes everything in body.Copy to periods
any idea why??
 
If it would help I would post my entire code but I have a feeling that might confuse more then help solve this problem
 
cuz you need to use the boolean operator not the assignment operator in your "if" statement, very common mistake, i hate making that error.

also some of the code seems unnecessary unless that was your debugging technique.
 
neurocomp2003 said:
cuz you need to use the boolean operator not the assignment operator in your "if" statement, very common mistake, i hate making that error.

also some of the code seems unnecessary unless that was your debugging technique.
Thank you for eyes...

I can't believe I missed that...

now only one problem left
 

jtbell

Mentor
15,193
2,787
I guess you must not have noticed that the next forum down, "Computers", has a sub-forum named "Programming." :smile:
 

The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top