Search:

Type: Posts; User: SauceGod

Search: Search took 0.01 seconds.

  1. Newton's Method for Approximating Roots. What is the error?

    /* This program will take an initial guess for the root of the equation (x^3)-3=0 and will use Newton's Method to approximate an approximate root after 500 iterations, or once the margin of error is...
  2. Replies
    4
    Views
    1,928

    Why can I not enter the last while loop?

    /* The user is to enter a 9-digit social security number and check whether the number entered by the user is a valid SSN from a list of SSNs in a text file. */



    #include <stdio.h>
    #include...
  3. Replies
    1
    Views
    4,134

    New help using a counter

    I need help understanding why this program outputs "Count = 3" if the input file is:

    -3xy' - ay" - bcos(t) = sin(t)
    ,
    4y - 3y' = - y'

    What I intended for my counter to output was the number...
  4. Replies
    4
    Views
    5,163

    Thank you. I implemented some changes, but still...

    Thank you. I implemented some changes, but still have the same problem.
  5. Replies
    4
    Views
    5,163

    Here is my revised code. However, my output is...

    Here is my revised code. However, my output is still multiple lines of " The above ODE is first order." The output should only be one line of "The above ODE is second order."



    main()
    { int i =...
  6. Replies
    4
    Views
    5,163

    Determining 2nd order ODE

    I'm having trouble identifying 1st and 2nd order ODEs. The file cp1_ODEin.txt contains the following:

    -3xy' - ay'' - bcos(t) = sin(t)

    However, the program identifies it as a 1st order ODE. Can...
  7. Replies
    2
    Views
    2,018

    Small error in C code segment

    The following code is supposed to set i to the first occurrence of a positive number in

    a[0], a[1], ... , a[n]

    or to n+1 if there are no positive numbers; however, the code is incorrect. I need...
  8. Can someone please explain to me the logic behind the output of this function?

    Input: abcd
    Output: dcba


    #include<stdio.h>
    #include<stdlib.h>


    void mystery(void);
  9. Replies
    1
    Views
    1,343

    Is this C code segment correct?

    Write a statement that copies the 4-byte int i into j, but with the order reversed.

    j = (i<<24) + (i>>24) + (((i>>8)<<24)>>8) + (((i<<8)>>24)<<8);
  10. Replies
    2
    Views
    5,355

    Why is the output 9?

    I am still a beginner. Can someone explain to me why the output of this program is 9?


    #include<stdio.h>
    #include<string.h>
    void f(int * w) {*w = *w+sizeof(w);}
    main(){
    int a=5;
    f(a);...
  11. Replies
    4
    Views
    5,848

    Actually, that still evaluates to 4. Did you mean...

    Actually, that still evaluates to 4. Did you mean to say that it expands to 2*3-1, which is equal to 5?
  12. Replies
    4
    Views
    5,848

    Why is the answer 5 to this code and not 4?

    I am still a novice. Can someone explain this to me? Why is the answer 5 instead of 4?

    insert

    #include<stdio.h>
    #define TWICE(x) 2*x
    main(){
    printf("%d\n", TWICE(3-1));
    }
  13. Ok. I updated the code and ran and compiled it. I...

    Ok. I updated the code and ran and compiled it. I still get the wrong answers. Thanks for pointing that out.
  14. Finding the min and max of a file of integers

    Can someone please give me a hint as to what is wrong with my code? I cannot find the correct min and max of a file of integers.

    insert

    #include<stdio.h>
    main()
    {
    int count = 0, sum = 0,...
  15. Replies
    2
    Views
    5,190

    Thank you. It worked.

    Thank you. It worked.
  16. Replies
    2
    Views
    5,190

    Can't write into out.txt

    This is a code I made that writes "Hello" to the file out.txt. However, when I open the file, it is blank. Is it because the file should not currently exist?

    insert

    #include<stdio.h>
    main()
    {...
Results 1 to 16 of 17