Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,263 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,506 people online right now. Registration is fast and FREE... Join Now!




Help! sequential search

 
Reply to this topicStart new topic

Help! sequential search

//no_comment
6 Nov, 2006 - 06:00 PM
Post #1

New D.I.C Head
*

Joined: 15 Sep, 2006
Posts: 16


My Contributions
This is a function to find a zero in an array and store the index of the element with the zero. Is this code correct because i have been testing it, and even when i know there's a zero in the element, it won't perform the if statement.
CODE

void draw(char deck[][COL], char hand[][COL])
{
    

    int index, index2;



  for(int x = 0; x < 8; x++)
  {
      
     target = hand[1][0];
    if(target == 0)
                  {
        index = x;
        cout << "you have found the number.";
                  }
  }

User is offlineProfile CardPM
+Quote Post

NyeNye
RE: Help! Sequential Search
6 Nov, 2006 - 06:08 PM
Post #2

D.I.C Head
**

Joined: 24 Sep, 2006
Posts: 248


My Contributions
CODE

  for(int x = 0; x < 8; x++)
  {
      
     target = hand[1][[b]x[/b]];


    if(target == 0)
                  {
        index = x;[b] <---explain what is this?? confused me..[/b]
        cout << "you have found the number.";
                  }
  }


.............



User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 07:17PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month