Search:

Type: Posts; User: hk_mp5kpdw

Page 1 of 20 1 2 3 4

Search: Search took 0.03 seconds.

  1. Replies
    12
    Views
    840

    a is a float, 6.7 is a double. When you assign...

    a is a float, 6.7 is a double. When you assign the double to the float you lose some precision. Then, you compare the float with a double which again have different levels of precision and you get...
  2. Replies
    12
    Views
    1,564

    Does each line only contain a couple characters? ...

    Does each line only contain a couple characters? If not then you are only counting what is in the second position in your buffer for each line processed. Wouldn't you also need to loop through the...
  3. Replies
    4
    Views
    763

    According to one source I found regarding the %e...

    According to one source I found regarding the %e format specifier in printf:

    Which seems to be echoed in another post here.

    So, assuming you are indeed on a Windows system maybe you could use...
  4. The read operation happens regardless of what...

    The read operation happens regardless of what value the state variable has, it runs until EOF is achieved.
  5. Replies
    3
    Views
    377

    You can also get rid of d completely if you...

    You can also get rid of d completely if you wanted and change this loop:


    for (b = 0; b<c; b++)
    {
    d = exp(b*log(10));
    e = e + d;
    }

    To this:
  6. Replies
    3
    Views
    580

    How to hack tutorial...

    How to hack tutorial by Hackerman.
  7. Replies
    3
    Views
    405

    V[0] represents the first element (the first...

    V[0] represents the first element (the first struct) as opposed to the address of the first element.
  8. Thread: const

    by hk_mp5kpdw
    Replies
    1
    Views
    432

    You have to initialize it at the point where you...

    You have to initialize it at the point where you create your variable:



    const char* bar[] = {"Hello","World"};
    const char* const* foo = bar;
  9. while(!feof(fp)) //scans through the file { ...

    while(!feof(fp)) //scans through the file
    {
    fscanf(fp, "%s%c%s%c%d%c%d%c", &wages[tax_no].surname, &ch, &wages[tax_no].first, &ch,
    &wages[tax_no].emp_income, &ch,...
  10. Replies
    3
    Views
    687

    Is the source computer using static or dynamic...

    Is the source computer using static or dynamic linking?
  11. Replies
    13
    Views
    666

    As is often the case, the issue can be approached...

    As is often the case, the issue can be approached in many ways. One such alternate still using a single loop is: test the result of the value of the counter variable modulus 5 within the loop to...
  12. Oops... see, I'm still learning new things even...

    Oops... see, I'm still learning new things even after all these years. Now, if I can only RETAIN said knowledge in my feeble mind.
  13. Nit: cout

    Nit:


    cout << sizeof(nElementIndex [ARRAY_LENGTH]) << endl;

    Since ARRAY_LENGTH is 10, the range of valid index values to use in accessing the nElementIndex array go from 0 through 9...
  14. Replies
    4
    Views
    605

    The i

    The i<a.size() part doesn't make sense to me. Should you be using MAX there instead of a.size()?

    There doesn't seem to be a need for the i variable, you can drop it and just use count instead.
  15. Replies
    10
    Views
    868

    The code posted would seem to have an error. It...

    The code posted would seem to have an error. It attempts to access index positions from the original array p_values that are likely out of bounds with regards to that array. The value of i in the...
  16. Replies
    5
    Views
    622

    The obvious approach would be to pass something...

    The obvious approach would be to pass something into func2 - a string perhaps - from the calling function that indicates who called it.
  17. Replies
    12
    Views
    807

    char ch; FILE* f; FILE* f2; f =...

    char ch;
    FILE* f;
    FILE* f2;
    f = fopen(configFile, "r");
    if( f != NULL ) // if config already exists, backup
    {
    f2 = fopen("kernels.bak", "w");
    while( ( ch = fgetc(f) ) != EOF )
  18. char c; ... while((c=fgetc(vlez))!=EOF) c...

    char c;
    ...
    while((c=fgetc(vlez))!=EOF)

    c should be declared as int and not char, this is especially important because of the test being made against EOF..
  19. Replies
    13
    Views
    1,113

    You should avoid mixing C/C++ I/O (cout/puts,...

    You should avoid mixing C/C++ I/O (cout/puts, cin/gets). Pick one and stick with it, preferably C++.
    If you must use C I/O, use fgets instead of gets.
    Const-correctness... member functions that...
  20. Replies
    5
    Views
    591

    char letter; ... printf("\n\t\t Wanna go back?...

    char letter;
    ...
    printf("\n\t\t Wanna go back? Type [Y] for yes or [N] for no. >>> ");
    scanf("%s", &letter);
  21. Replies
    10
    Views
    942

    FWIW, your code variable is 8 characters and you...

    FWIW, your code variable is 8 characters and you are treating it as a C-style string when printing using puts which means that it can only reasonably store 7 characters (with the remaining one being...
  22. Cross-posted @ programmersheaven.com...

    Cross-posted @ programmersheaven.com
  23. Replies
    3
    Views
    633

    printf("Enter how many states:"); scanf("%d",...

    printf("Enter how many states:");
    scanf("%d", &n);
    for (i = 1; i < n; i++)

    Assume you enter 2 for the number of states... this loop will start with i equal to 1. Is 1 less than 2? Yes,...
  24. Replies
    6
    Views
    797

    You've got these bits in several places: ...

    You've got these bits in several places:



    char c;
    while((c = getchar()) != EOF) {
  25. Replies
    44
    Views
    2,714

    Small correction ;) - Blue color: This tells...

    Small correction ;)

    - Blue color: This tells you the function where the function was called from, the function that the linker couldn't find.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4