Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Any suggestions?

Any suggestions?

Scheduled Pinned Locked Moved C / C++ / MFC
testingbeta-testingregexquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dellthinker
    wrote on last edited by
    #1

    Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do. #include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; } Any suggestions? Thanx in advance!

    J N D 3 Replies Last reply
    0
    • D dellthinker

      Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do. #include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; } Any suggestions? Thanx in advance!

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      Well the “while” loop will run forever, unless you end the process via the “Windows Task Manager”, because neither string is ever going to change. Of course you do not need to worry about that, because “test” is never going to equal “test1”, so the “while” loop will never run. I recommend that next time you try to explain what you are attempting to do. The odds are that someone who frequents CP has already tried it.

      INTP "Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

      1 Reply Last reply
      0
      • D dellthinker

        Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do. #include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; } Any suggestions? Thanx in advance!

        N Offline
        N Offline
        nbugalia
        wrote on last edited by
        #3

        Try this one -

        CString test="Testing this";
        CString test1="Testing the other side";
        int count = 0;
        while (test != test1)//wait until some other thread make test equal to test1
        {
        Sleep(90);
        if (count++ == 10)//or wait until the count is not equal to 100
        break;
        }

        1 Reply Last reply
        0
        • D dellthinker

          Hi all. Im trying to make a function to try to attempt something, but when it fails try "one" more time and then move on to the next thing. So far i've made something that doesnt look close to what i have to do. #include #include #include using namespace std; int main() { string test="Testing this"; string test1="Testing the other side"; if(test == test1){ while(test == test1){ Sleep(9000); cout << "Match " << endl; } } else{ cout << "No match! " << endl; } return 0; } Any suggestions? Thanx in advance!

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          dellthinker wrote:

          Im trying to make a function to try to attempt something...

          Such as? :confused:


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups