Skip to main content
formatted code, edited tags
Source Link
ChrisG
  • 7.4k
  • 2
  • 17
  • 26

okOk this is the code for sorting I have written but now I dontdon't know what file to compile to check for my results.Cuz Because of the addition of printfprintf() function I have added stdio.hstdio.h into my helpers.chelpers.c but still I am not getting my printfsprintf()s. Tried compiling with ./generate 10 50 | ./find 12./generate 10 50 | ./find 12 still no result....I cant I can't get my sorting list printed out.Am Am i missing some key thing here?

void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {

    for (i = 0; i < n - j; i++)
    {
        if (values[i] > values[i +1])
        {
        int temp = values[i] ;
        values[i] = values[i+1] ;
        values[i+1] = temp ;
        
        }
    }
}    
return;
for ( k = 0; k < n; k++)
{
    printf("no %i : %i\n", k , values[k]);
}

}

void sort(int values[], int n)
{
    // TODO: implement an O(n^2) sorting algorithm
    int i, j, k;
    for ( j = 0; j < n - 1; j++)
    {
    
        for (i = 0; i < n - j; i++)
        {
            if (values[i] > values[i +1])
            {
            int temp = values[i] ;
            values[i] = values[i+1] ;
            values[i+1] = temp ;
            
            }
        }
    }    
    return;
    for ( k = 0; k < n; k++)
    {
        printf("no %i : %i\n", k , values[k]);
    }

}

orOr am i supposeI supposed to make another file paste this code in there and get an array of lets say 10 ints throughtthrough GetInt() and than see if I am getting the desired sorted list or not?

ok this is the code for sorting I have written but now I dont know what file to compile to check for my results.Cuz of the addition of printf function I have added stdio.h into my helpers.c but still I am not getting my printfs. Tried compiling with ./generate 10 50 | ./find 12 still no result....I cant get my sorting list printed out.Am i missing some key thing here?

void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {

    for (i = 0; i < n - j; i++)
    {
        if (values[i] > values[i +1])
        {
        int temp = values[i] ;
        values[i] = values[i+1] ;
        values[i+1] = temp ;
        
        }
    }
}    
return;
for ( k = 0; k < n; k++)
{
    printf("no %i : %i\n", k , values[k]);
}

}

or am i suppose to make another file paste this code in there and get an array of lets say 10 ints throught GetInt() and than see if I am getting the desired sorted list or not?

Ok this is the code for sorting I have written but now I don't know what file to compile to check for my results. Because of the addition of printf() function I have added stdio.h into my helpers.c but still I am not getting my printf()s. Tried compiling with ./generate 10 50 | ./find 12 still no result. I can't get my sorting list printed out. Am i missing some key thing here?

void sort(int values[], int n)
{
    // TODO: implement an O(n^2) sorting algorithm
    int i, j, k;
    for ( j = 0; j < n - 1; j++)
    {
    
        for (i = 0; i < n - j; i++)
        {
            if (values[i] > values[i +1])
            {
            int temp = values[i] ;
            values[i] = values[i+1] ;
            values[i+1] = temp ;
            
            }
        }
    }    
    return;
    for ( k = 0; k < n; k++)
    {
        printf("no %i : %i\n", k , values[k]);
    }

}

Or am I supposed to make another file paste this code in there and get an array of lets say 10 ints through GetInt() and than see if I am getting the desired sorted list or not?

Post Undeleted by Furrukh Jamal
Post Deleted by Furrukh Jamal
Post Undeleted by Furrukh Jamal
Post Deleted by Furrukh Jamal
added 185 characters in body
Source Link

ok this is the code for sorting I have written but now I dont know what file to compile to check for my results.Cuz of the addition of printf function I have added stdio.h into my helpers.c but still I am not getting my printfs. Tried compiling with ./generate 10 50 | ./find 12 still no result....I cant get my sorting list printed out.Am i missing some key thing here?

void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {

    for (i = 0; i < n - j; i++)
    {
        if (values[i] > values[i +1])
        {
        int temp = values[i] ;
        values[i] = values[i+1] ;
        values[i+1] = temp ;
        
        }
    }
}    
return;
for ( k = 0; k < n; k++)
{
    printf("no %i : %i\n", k , values[k]);
}

}

or am i suppose to make another file paste this code in there and get an array of lets say 10 ints throught GetInt() and than see if I am getting the desired sorted list or not?

ok this is the code for sorting I have written but now I dont know what file to compile to check for my results.Cuz of the addition of printf function I have added stdio.h into my helpers.c but still I am not getting my printfs. Tried compiling with ./generate 10 50 | ./find 12 still no result....I cant get my sorting list printed out.Am i missing some key thing here?

void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {

    for (i = 0; i < n - j; i++)
    {
        if (values[i] > values[i +1])
        {
        int temp = values[i] ;
        values[i] = values[i+1] ;
        values[i+1] = temp ;
        
        }
    }
}    
return;
for ( k = 0; k < n; k++)
{
    printf("no %i : %i\n", k , values[k]);
}

}

ok this is the code for sorting I have written but now I dont know what file to compile to check for my results.Cuz of the addition of printf function I have added stdio.h into my helpers.c but still I am not getting my printfs. Tried compiling with ./generate 10 50 | ./find 12 still no result....I cant get my sorting list printed out.Am i missing some key thing here?

void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {

    for (i = 0; i < n - j; i++)
    {
        if (values[i] > values[i +1])
        {
        int temp = values[i] ;
        values[i] = values[i+1] ;
        values[i+1] = temp ;
        
        }
    }
}    
return;
for ( k = 0; k < n; k++)
{
    printf("no %i : %i\n", k , values[k]);
}

}

or am i suppose to make another file paste this code in there and get an array of lets say 10 ints throught GetInt() and than see if I am getting the desired sorted list or not?

Source Link

What file am I suppose to compile to see my output in Pset3 Sorting?

ok this is the code for sorting I have written but now I dont know what file to compile to check for my results.Cuz of the addition of printf function I have added stdio.h into my helpers.c but still I am not getting my printfs. Tried compiling with ./generate 10 50 | ./find 12 still no result....I cant get my sorting list printed out.Am i missing some key thing here?

void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {

    for (i = 0; i < n - j; i++)
    {
        if (values[i] > values[i +1])
        {
        int temp = values[i] ;
        values[i] = values[i+1] ;
        values[i+1] = temp ;
        
        }
    }
}    
return;
for ( k = 0; k < n; k++)
{
    printf("no %i : %i\n", k , values[k]);
}

}