Search:

Type: Posts; User: vxs8122

Search: Search took 0.00 seconds.

  1. Replies
    6
    Views
    1,310

    What do you mean? I just compiled the program...

    What do you mean? I just compiled the program and it printed all the primes from 2 to 150 without any problems.
  2. Replies
    6
    Views
    1,310

    Thanks. All I did is change P array size to 151...

    Thanks. All I did is change P array size to 151 and that fixed the problem. What this code does is finding all prime numbers from 2 to 150 using Sieve of Erastosthenes algorithm.
  3. Replies
    6
    Views
    1,310

    Why am I keep getting infinite loops?

    See code below:


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

    int main ( int argc, char *argv[] )
    {
    int P[150] = {}, i, j;
  4. Replies
    6
    Views
    5,222

    Ok, I now see why it exits like that. And yeah,...

    Ok, I now see why it exits like that. And yeah, it's not worth a trouble fixing this over a homework problem. Thanks much!
  5. Replies
    6
    Views
    5,222

    Ok now, I modified again and it worked pretty...

    Ok now, I modified again and it worked pretty well. However, if I typed something like "10a" I get something like:

    Enter a temperature in Fahrenheit (enter a nonnumeric value to exit):
    10a...
  6. Replies
    6
    Views
    5,222

    I followed what you suggested, but right now the...

    I followed what you suggested, but right now the program loops once no matter what value I input. I need to make it loop again when the input is a numeric value.

    Here is the modified program:

    ...
  7. Replies
    6
    Views
    5,222

    How do I check input for nonnumeric value?

    See my code below:




    /*
    * ======================================================================
    *
    * Filename: ex08.c
    *
  8. Program not printing exactly what I wanted

    I expected this program to print out:


    Enter your desired monthly salary: $2000___
    Gee! $2000.00 a month is $24000.00 a year.

    Instead, it printed out:


    Enter your desired monthly...
  9. Replies
    1
    Views
    766

    Oh wow, I feel retarded. I just realized that f...

    Oh wow, I feel retarded. I just realized that f is actually a number not a notation for floating number.
  10. Replies
    1
    Views
    766

    Hexadecimal question

    As for hexadecimal system in C programming, why does .1 really equal to 1/16 plus 5/256, not just 1/16?

    For instance, the number 0xa.1p10 should theoretically equal to:

    (10*160 + 1*16-1)*210 =...
  11. Replies
    6
    Views
    1,155

    I checked inside the main.c file and on line 29,...

    I checked inside the main.c file and on line 29, I noticed that the variable was already used:



    bool isActive = true;


    Yet the compiler does not recoginze that. Why did that happen?
  12. Replies
    6
    Views
    1,155

    Is there a way to ignore this specific warning?

    Is there a way to ignore this specific warning?
  13. Replies
    6
    Views
    1,155

    Problems compiling this file

    I was following this GDB debugging tutorial:

    Peter's gdb Tutorial: Debugging With Your Brain

    I downloaded, extracted and tried to compile the file spinning_cube.tar.bz2 using make command. I...
  14. Replies
    3
    Views
    840

    Question about pointers

    From what I understand about pointers:



    int k = 5; // create a new variable k with a value of 5
    int *ptr; // create new pointer ptr
    ptr = &k; // make ptr point to the address of k
    *ptr...
  15. No I did not create setjmp.h, it is already...

    No I did not create setjmp.h, it is already included in the library. Check out setjmp.h - Wikipedia, the free encyclopedia.
  16. Other question: does longjmp() cause a frame in...

    Other question: does longjmp() cause a frame in the middle of the stack to be deallocated?

    For example:




    #include <stdio.h>
    #include <setjmp.h>
  17. I see! The numbers are being treated as boolean...

    I see! The numbers are being treated as boolean TRUE and FALSE. Thanks for clearing up.
  18. Then that leads to other question. I don't...

    Then that leads to other question. I don't understand the sythax of this part. It sounds like an uncompleted sentence "If not setjmp(buf), then run function first()."
  19. Confusion with usage of ! operator in if statment

    See example below:




    #include <stdio.h>
    #include <setjmp.h>

    static jmp_buf buf;
  20. Replies
    5
    Views
    6,435

    Thanks, I understand now. So there is absolutely...

    Thanks, I understand now. So there is absolutely no way to resize the double_digit array while keeping all the data?
  21. Replies
    5
    Views
    6,435

    You are correct, however, the old values are...

    You are correct, however, the old values are stored in new_array (see lines 28-33) then later stored in the new double_digit array.
  22. Replies
    5
    Views
    6,435

    Array prints strange numbers?

    What I am trying to do is to have the program create 2D array that for each row, no two numbers are the same and only consists numbers between 1-9. The array lists out every possible combinations. ...
Results 1 to 22 of 22