Search:

Type: Posts; User: tomeatworld

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    7,399

    Conflicting Types for function

    I'm trying to compile my program but am constantly getting the same error. on compiling the message is: "error: conflicting types for 'evaluate'"
    "note: previous declaration of...
  2. i've used: for(i=0; i

    i've used:



    for(i=0; i<MAX_ROWS; i++)
    {
    fscanf(input, "%f %f", &x[i], &fx[i]);
    }

    but it hasn't worked properly. Is there a reason for this?
  3. Thanks a load!

    Thanks a load!
  4. Importing from 2 columns to seperate arrays

    So I've run into a problem that I need to solve.
    I have a file that has two columns and I need to read this file, and put each column to a separate array. I've done the array sizing, and I've...
  5. Calling multiple arrays to the same function

    So I'm just having trouble with what c can actually do and how.
    I've got a program which calls a function at some points to evaluate multiplication of values within different arrays. I have 3...
  6. Replies
    4
    Views
    3,683

    I've managed to fix it. I'd defined my matrix...

    I've managed to fix it. I'd defined my matrix with dimensions i and j which meant it didn't have enough memory (i think). I've got it working now! Thanks anyway!
  7. Replies
    4
    Views
    3,683

    I get a seg fault when run!

    I get a seg fault when run!
  8. Replies
    4
    Views
    3,683

    Importing File to Array

    So I'm trying to inport a file into an array. The file is of known size, containing 9 numbers (ie a 3x3 matrix) separated by spaces and new lines. I need to take this file, and turn it into an array....
  9. Replies
    21
    Views
    5,177

    I added the variable checking which worked fine...

    I added the variable checking which worked fine for checking variables, but changed the output of my program. I used:


    if(sscanf(argv[1], "%lf", &a) != 1 || sscanf(argv[2], "%lf", &a) != 1 ||...
  10. Replies
    19
    Views
    86,954

    I found my problem. I had a statement for finding...

    I found my problem. I had a statement for finding the determinant before these if statements and of course the determinant was 0 if b and a or c were 0 so it was having problems. Fixed now! Thanks a...
  11. Replies
    19
    Views
    86,954

    The problem is I need certain clauses for if a...

    The problem is I need certain clauses for if a and b = 0 and then a,b and c = 0 etc which would mean repeating myself multiple times in those 3 if statements.
  12. Replies
    19
    Views
    86,954

    Changed my code to: else if(a == 0) {...

    Changed my code to:


    else if(a == 0)
    {
    if(b == 0)
    {
    /* If a, b and c are 0, no equation */
    if(c == 0)
    {
  13. Replies
    21
    Views
    5,177

    There's an error message about "too few arguments...

    There's an error message about "too few arguments to function 'sscanf' " when I try to compile. I'll leave it I think, but thanks for the attempts!
  14. Replies
    21
    Views
    5,177

    So using something like ...

    So using something like



    if(sscanf(argv[1]) != 1)
    {
    exit(failure)
    }
  15. Replies
    19
    Views
    86,954

    Ok thanks a lot! I'll work that into what I need....

    Ok thanks a lot! I'll work that into what I need. Thanks again!
  16. Replies
    19
    Views
    86,954

    Thanks, but where abouts do you mean? In the...

    Thanks, but where abouts do you mean? In the integrated if function (inside "if(a == 0)")?
  17. Replies
    21
    Views
    5,177

    I keep getting "Segmentation faults" whenever I...

    I keep getting "Segmentation faults" whenever I try it. Currently using:



    if(argc != 4)
    {
    printf("Please enter 3 variables after program name.\n");
    exit(EXIT_FAILURE);
    }
    /* Check...
  18. Replies
    21
    Views
    5,177

    If I haven't scanned the values, how will it know...

    If I haven't scanned the values, how will it know what to test against?
    To me seems like that would test the argv[x] values and then let the user change them to a letter and the program goes on...
  19. Replies
    21
    Views
    5,177

    So instead of using 'isalpha(a)' I'd have to use...

    So instead of using 'isalpha(a)' I'd have to use 'isalpha(argc[1])'?
  20. Replies
    21
    Views
    5,177

    Sorry, realised I didn't post the whole code. I...

    Sorry, realised I didn't post the whole code. I already have a number of inputs check, I'm just interested now as to if they are numbers, and if not, showing an error message:



    if(argc...
  21. Replies
    19
    Views
    86,954

    I'm afraid not. In the cases where some are 0,...

    I'm afraid not. In the cases where some are 0, the function can still work.
    For example, if only c is zero a result is still possible.
  22. Replies
    21
    Views
    5,177

    So by using something along the lines of: ...

    So by using something along the lines of:



    else
    {
    sscanf(argv[1], "%lf", &a);
    sscanf(argv[2], "%lf", &b);
    sscanf(argv[3], "%lf", &c);
    if(isalpha(a) || isalpha(b) || isalpha(c))
  23. Replies
    21
    Views
    5,177

    Validating Inputs: Only Numbers

    So I've written a program that works almost perfectly and the only thing it's missing is an input validation to stop letters being allowed as inputs. I'm not very sure what you would call doing this...
  24. Replies
    19
    Views
    86,954

    Sure. The bit including what i'm talking about: ...

    Sure. The bit including what i'm talking about:



    if(DET < 0)
    {
    printf("The roots of this equation are imaginary!\n");
    }
    else if(DET == 0)
    {
  25. Replies
    19
    Views
    86,954

    I tried using the if within an if, but it still...

    I tried using the if within an if, but it still won't work as required. I have:



    else if(a == 0)
    {
    if(b == 0 && c != 0)
    {}
    else if(c ==0 && b != 0)
    {}
Results 1 to 25 of 26
Page 1 of 2 1 2