Search:

Type: Posts; User: dsured

Search: Search took 0.00 seconds.

  1. euclids algorithm to find GCD with counter not getting right output

    #include <stdio.h>

    int euclid(int a,int b, int c)
    {
    if(b==0){
    c++;
    return a;

    }
    else {
  2. Linked lists--do these programs both clear the list?

    What is the difference between these programs? I am studying for an exam and I think the 2nd one is easier to follow, its recursive I know that...




    void ResetList(struct point **ptrFirst,...
  3. Thanks! When I run the code, nothing comes up,...

    Thanks!

    When I run the code, nothing comes up, I mean--when I input data and press enter, it moves to a new line... I have a feeling the code isn't processing anything.




    luna:~>a.out
    1234...
  4. Thank you for the tips so far. I added the...

    Thank you for the tips so far.

    I added the string.h at the start,
    I pressed enter on the source file, employee.dat, and I still got the same errors


    "lab7.c", line 84: warning: newline not...
  5. I created a blank employee.dat file and this is...

    I created a blank employee.dat file and this is what the compiler gave me

    "lab7.c", line 4: warning: invalid white space character in directive
    "lab7.c", line 38: warning: implicit function...
  6. Segmentation fault (core dumped)? Where did I go wrong?

    When I run my program I get this...

    where am I going wrong?

    "lab7.c", line 4: warning: invalid white space character in directive
    "lab7.c", line 38: warning: implicit function declaration:...
  7. Replies
    8
    Views
    15,509

    This is what I have *fgets(char *e,...

    This is what I have



    *fgets(char *e, sizeof(e), file);
  8. Replies
    8
    Views
    15,509

    I tried what you said and I had issues. I added...

    I tried what you said and I had issues. I added the fgets before the loop and got the error "incompatible type for argument 1 of fgets"


    if(file ==NULL){
    printf("Cannot create...
  9. Replies
    8
    Views
    15,509

    Read A File From A Specific Line

    The object of my assignment is to read data from a file, capitalize the first letter of all the names within the file and rewrite the file. Simple enough right?

    Just one small problem. The file we...
  10. Replies
    3
    Views
    1,554

    is it really needed when doing a scanf?

    is it really needed when doing a scanf?
  11. Replies
    3
    Views
    1,554

    what does this function do? fgetc

    void flush_in (){
    int ch;
    while ((ch = fgetc (stdin))!= EOF && ch != '\n'){}
    }

    an example of when its called is


    scanf("%s",contact[i].postalcode);
    flush_in();
  12. Replies
    2
    Views
    749

    Help with tracing - points and functions

    Can someone please walk me through the trace of this code? I have been trying for awhile and get the output wrong!




    #include <stdio.h>
    int f(float);
    float g(int);
    int h(int*);
  13. Replies
    3
    Views
    13,935

    Storing Tokens Into Array

    Hi! I am trying to figure out a way to store all tokens of a sentence into an array except the token 'done' which is the last word of the sentence, but not part of the sentence itself (it is purely...
  14. Replies
    2
    Views
    1,039

    Compressing a file, then uncompressing

    I have tried and gotten most of it, I put a comment by the else "//must be a digit. Build a number." Where I need the help. Some notes:
    There is a 100 word upper limit on the number of different...
  15. My call by reference bubble sort code isn't displaying the correct output

    The program compiles, however the output is incorrect

    Output:


    Input size of array5
    Input elements3
    5
    4
    7
  16. I did include math.h in the header.

    I did include math.h in the header.
  17. I should have included this, ...

    I should have included this,


    s=values[j]+values[l];
    number1=r-t;
    number2=r-s;
    if (number1<0)
    number1*=-1;
    if (number2<0)
    number2*=-1;
  18. What else could I use instead of this IF statement?

    I am just curious if there is any other way I could write this code, I see 3 if statements in a row and am wondering if there is a more efficient way.



    if (number1<0)
    number1*=-1;
    if...
  19. Replies
    5
    Views
    4,325

    Delete

    Delete
  20. Replies
    5
    Views
    4,325

    2 dimensional array bubble sort

    I need help to make a program that generates random numbers and sorts them using bubble sort
  21. I cannot pass any parameters in function calls. ...

    I cannot pass any parameters in function calls.

    It was a required instruction for this program, I am a little stuck, I got it running for one Washer, but adding another one, I have been working on...
  22. Global variables, how can I add washerB to this program?

    #include <stdio.h>
    #include <math.h>

    double quantity1, thickness1, density1, inner1, outer1;
    double product, area;
    double washerA;

    /* Prototypes */

    void ReadData...
  23. Replies
    5
    Views
    1,116

    No I have not, can you give me an example using...

    No I have not, can you give me an example using my program to get me in the right direction please?
  24. Replies
    5
    Views
    1,116

    How would I do that, I am new at programming! ...

    How would I do that, I am new at programming! Just getting used to the forum.
  25. Replies
    5
    Views
    1,116

    basic C program, using global parameters

    Closed, please remove.

    Thanks.
Results 1 to 25 of 25