Search:

Type: Posts; User: M-S-H

Search: Search took 0.07 seconds.

  1. Replies
    15
    Views
    2,592

    Awesome, that seems to work. Thanks so much for...

    Awesome, that seems to work. Thanks so much for your help.
  2. Replies
    15
    Views
    2,592

    cool, never mind my edit then.... let me try that.

    cool, never mind my edit then.... let me try that.
  3. Replies
    15
    Views
    2,592

    How so? the first message has a priority of 3 and...

    How so? the first message has a priority of 3 and the second 1, so wouldn't is swap them?
    Oh, got it.... so i could just create an if statement to correct this problem? if amount == 2, then another...
  4. Replies
    15
    Views
    2,592

    yeah, i did, and its still not sorting right....

    yeah, i did, and its still not sorting right.
    For example, the two text files:

    First:

    3I hope this works

    Second:

    1This program is awesome
  5. Thread: Convert c to c++

    by M-S-H
    Replies
    17
    Views
    2,584

    yeah, i did, and its still not sorting right....

    yeah, i did, and its still not sorting right.
    For example, the two text files:

    First:

    3I hope this works

    Second:

    1This program is awesome
  6. Replies
    15
    Views
    2,592

    I no longer get a segmentation fault, but its not...

    I no longer get a segmentation fault, but its not sorting them correctly. Once a priority 3 was printed before a priority 1, then a 2 was first, then 1, then 3; then with everything was sorted...
  7. Replies
    15
    Views
    2,592

    i did change both to make temp = packages[j];...

    i did change both to make temp = packages[j];
    and j=amount-i should have been j<amount-i, but still no luck

    Here's the updated code:

    /*************
    Michael Hickman
    ECE 231
    *************/
  8. Replies
    15
    Views
    2,592

    well i thought this change would make it work,...

    well i thought this change would make it work, but it didn't

    temp = packages[j];
    packages[j] = packages[j+1];
    packages[j+1] = temp;
  9. Replies
    15
    Views
    2,592

    yeah, its basically bubble sort... so what would...

    yeah, its basically bubble sort...
    so what would be a better way?
  10. Replies
    15
    Views
    2,592

    Segmentation fault

    I'm creating a program that reads text files, each with a priority and message, and then prints them in the correct order. Files with higher priority are printed first, and if they have the same...
  11. Replies
    22
    Views
    6,225

    Alright, thanks so much for all your help. I...

    Alright, thanks so much for all your help. I really appreciate it.
  12. Replies
    22
    Views
    6,225

    i fixed the bracket, and it compiled fine, but...

    i fixed the bracket, and it compiled fine, but when i ran it,
    a null must have been returned because it displayed "out of memory"
    now how do i fix that?
  13. Replies
    22
    Views
    6,225

    I changed all my code to /* File: matrix.h...

    I changed all my code to


    /* File: matrix.h */
    #ifndef MATRIXh
    #define MATRIXh
    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
    #define FORMAT "%8.3lf"
  14. Replies
    22
    Views
    6,225

    Header File: /* File: matrix.h */ #ifndef...

    Header File:

    /* File: matrix.h */
    #ifndef MATRIXh
    #define MATRIXh
    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
    #define FORMAT "%8.3lf"
  15. Replies
    22
    Views
    6,225

    i made all those corrections, but i still get the...

    i made all those corrections, but i still get the same compile error:
    subscripted value is neither array nor pointer - referring to:

    new_matrix.element[i][j] = values[i][j];

    as well as a new...
  16. Replies
    22
    Views
    6,225

    I understand how to set up the matrix, but im now...

    I understand how to set up the matrix, but im now having trouble passing in an 2d array.

    The array is set up as:

    double one[2][3] = {
    {1,2,3},
    ...
  17. Replies
    22
    Views
    6,225

    First off, thanks for being patient...im new to...

    First off, thanks for being patient...im new to programming.

    Second the only compile errors refer to

    for(j=0; j<rdim; j++)
    new_matrix -> element[i][j] = values[i][j]; // does not work...
  18. Replies
    22
    Views
    6,225

    so i changed my structure to: typedef struct {...

    so i changed my structure to:

    typedef struct {
    int rowdim, coldim;
    double** element;
    } matrix;

    and then my other code to:

    #include "matrix.h"
  19. Replies
    22
    Views
    6,225

    well how would i keep it as a two dimensional...

    well how would i keep it as a two dimensional array? Im thinking that I'll have to use a double pointer, but dont know how to set that up.
  20. Replies
    22
    Views
    6,225

    Alright, so i changed my code to: #include...

    Alright, so i changed my code to:

    #include "matrix.h"

    matrix create_empty(int rdim, int cdim)
    {
    matrix* new_matrix;
    new_matrix = malloc(sizeof(matrix));
    new_matrix -> rowdim = rdim;...
  21. Replies
    22
    Views
    6,225

    i read something online about a double pointer...

    i read something online about a double pointer being used when working with 2d arrays, but how exactly are they used?
  22. Replies
    22
    Views
    6,225

    Pointer to a 2d array

    I'm trying to write a program that will create and work with matrices, but im having problems with a pointer to a 2d array.

    I created this structure in a header file:

    typedef struct {
    int ...
  23. Thread: Sudoku solver

    by M-S-H
    Replies
    10
    Views
    16,774

    LOL, in my defense, ive only been programming...

    LOL,
    in my defense, ive only been programming for a month or two
    I did add a print statement, but that cause the program to not work. It would print values of t, but it wouldn't print the...
  24. Thread: Sudoku solver

    by M-S-H
    Replies
    10
    Views
    16,774

    Need Help understanding a Sudoku solver

    So I found this sudoku solver and I understand the basics, but there are a few things that I quite dont understand, and was wondering if anyone could help.


    #include <stdio.h>

    int grid[9][9];...
Results 1 to 24 of 24