Skip to main content
added 155 characters in body
Source Link
Kiwi
  • 179
  • 1
  • 2
  • 11

I can not figure out what There is the problemsomething wrong with my code. pset3 findkeyformula in vigenere cipher, and error message: expected expression

I red all the questions with the code about the same issue but I can't figure out what is wrong with my code. When I use the command ./generate 1000 50 | ./find 127 I get: Didn't find needle in haystack. What am I doing wrong?

bool search(int value, int values[], int n)

{

if (n < 1)
{
    
    for (int i = 0; i < n; i++)
    {
        if (values[i] == value)
        {   
            return true;
        }
        return false;
    }
    else
    {
        return false;
    } 
}

}

When I write make find in the terminator I get the next error:

helpers.c:29:5: error: expected expression

else

^

What am I doing wrong?

I can not figure out what is the problem with my code. pset3 find

I red all the questions with the code about the same issue but I can't figure out what is wrong with my code. When I use the command ./generate 1000 50 | ./find 127 I get: Didn't find needle in haystack. What am I doing wrong?

bool search(int value, int values[], int n)

{

if (n < 1)
{
    
    for (int i = 0; i < n; i++)
    {
        if (values[i] == value)
        {   
            return true;
        }
        return false;
    }
    else
    {
        return false;
    } 
}

}

There is something wrong with my keyformula in vigenere cipher, and error message: expected expression

I red all the questions with the code about the same issue but I can't figure out what is wrong with my code. When I use the command ./generate 1000 50 | ./find 127 I get: Didn't find needle in haystack. What am I doing wrong?

bool search(int value, int values[], int n)

{

if (n < 1)
{
    
    for (int i = 0; i < n; i++)
    {
        if (values[i] == value)
        {   
            return true;
        }
        return false;
    }
    else
    {
        return false;
    } 
}

}

When I write make find in the terminator I get the next error:

helpers.c:29:5: error: expected expression

else

^

What am I doing wrong?

Source Link
Kiwi
  • 179
  • 1
  • 2
  • 11

I can not figure out what is the problem with my code. pset3 find

I red all the questions with the code about the same issue but I can't figure out what is wrong with my code. When I use the command ./generate 1000 50 | ./find 127 I get: Didn't find needle in haystack. What am I doing wrong?

bool search(int value, int values[], int n)

{

if (n < 1)
{
    
    for (int i = 0; i < n; i++)
    {
        if (values[i] == value)
        {   
            return true;
        }
        return false;
    }
    else
    {
        return false;
    } 
}

}