C++ Programming Help: Troubleshooting "<" to ".

  • Context: C/C++ 
  • Thread starter Thread starter Tom McCurdy
  • Start date Start date
  • Tags Tags
    Programming
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 3K views
Tom McCurdy
Messages
1,021
Reaction score
1
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??
 
Physics news on Phys.org
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