User Profile

Collapse

Profile Sidebar

Collapse
ravenspoint
ravenspoint
Last Activity: Jul 27 '07, 07:53 PM
Joined: Jul 19 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • ravenspoint
    replied to Reinitialization of same variable
    in C
    Is that right? I confess I have always been vague about the difference between 'define' and 'declare'

    Sorry abut that.

    The thing to keep in mind is that when you write something like

    int x;

    the compiler allocates some memory where it keeps the value of x.

    You cannot now tell it to store another variable with the same name somewhere else in memory.
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to sort hash_set in alphabetical order
    in C
    It calciulates the position where the new insertion should go. This involves the comparison with some, not all, the previously inserted. The details depend on the algorithm used. Then it comapares the new value with the one already "there". If they are different, it is placed beside the old value. If they are the same, the new one is rejected....
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to Reinitialization of same variable
    in C
    You have told the compiler to store siVar in two different places. It rightly refuses.

    Declare the variable, with or without an initiazation, just once. Then you can only change its value....
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to random numbers..
    in C
    Granted.

    However, most coding jobs fall between these extremes. Quick and dirty solutions to small problems some-one is prepared to pay a hundred bucks to fix.

    Coding for a lottery system would be a grand job....
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to random numbers..
    in C
    By free, I did not mean that you did not have to write a check.

    I meant that you do not have to select an generator, install it, link it to your program, distribute it to your clients, and document why you chose it. This is all a huge amount of work for anyone who is not paid by the hour.

    The standard generator is just there, free.
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to random numbers..
    in C
    That is so harsh!

    In fact the standard generator is free, widely available and well understood. These are important benefits not shared by a home brewed generator. They are so important benefits, that I would suggest using the standard generator, unless someone can show a very good reason why it would be the wrong choice.

    If you routinely reseed the generator from the least significant digits of the system clock, then...
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to Erasing Array elements in C
    in C
    Since you mentioned vector in your opriginal post ( OP ) I assumed that you had STL.

    You should check to see if you do, since it is extremely helpful and will save you many hours of work.

    If you do not have STL, then getchar's scheme sounds workable. Have you tried it?...
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to Erasing Array elements in C
    in C
    There is no need to write such a function. The vector and other STL containers provide the method erase() to do this.
    See more | Go to post

    Leave a comment:


  • Don't give up on Replace. It isn't hard to use.
    [CODE=cpp]
    CString in = "love!";
    CString in2 = in;
    in2.Replace( "!", "" );
    cout << in << in2 << endl;
    [/CODE]
    See more | Go to post

    Leave a comment:


  • I am not sure that I understood your entire post.

    However, it may be useful to tell you that CString has a method Replace which will replace all characters found with something else, or just remove them by replacing them with nothing.

    Does that sound useful?

    If you want to get fancy and use the much more powerful regular expressions, then I have found the class CAtlRegExp to be workable, though the interface...
    See more | Go to post

    Leave a comment:


  • Perhaps the safest way would be destroy the window, then create it again with a different ID.

    If a redraw does not happen while you do this, then the user will not notice.
    See more | Go to post

    Leave a comment:


  • That's a clever solution.

    Use a bit array for the the map, so as not to double your storage requirements.

    If you enjoy fancy footwork, make the map entirely abstract and use simple compression, so that

    [ 1,1,1,0,1,1] becomes [0-2,4-5]...
    See more | Go to post

    Leave a comment:


  • Set it equal to a pointer to the head of the list, which you have kept somewhere convenient.
    See more | Go to post

    Leave a comment:


  • It may be time to upgrade from arrays to STL vectors. If you do so you will gain many things, incuding the method erase which removes a specified element,
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to Resizing Window
    in C
    The change should take place immediatly, for all windows, as soon as you click 'OK' and then 'apply'. No need to open a new window.

    Try toggling the check box, clicking a'OK', clicking 'Apply' and then resizing any window.

    If you cannot see a difference, then there is something very wrong with your system....
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to random numbers..
    in C
    zodilla58: He doesn't have any code to post - he doesn't know how to begin. If you want to be a policeman, go somewhere else.

    OP: The first question you have to ask is, what kind of random numbers do you want?

    There are real random numbers, which no-one can predict. They have to be obtained from some physical process, like tossing a coin and storing the results, or looking at the least significant bit of a clock.
    ...
    See more | Go to post

    Leave a comment:


  • If this is a school assignment you will probably have to hack around with iostream or something, as Raghuram says.

    In the real world we use fread()

    [CODE=cpp]fread(
    p, // point to buffer for storing data
    4, // size of data items
    N, // number of items
    fp ); // file pointer[/CODE]

    This works in C and C++
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to basic code not working
    in C
    Add the following line at the top of your code:

    #include <iostream>
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to difference between if, and while
    in C
    It is unusual to describe the if statement as a kind of loop.

    The statements following an if are executed exactly once if the if statement is true,

    The statements following a while are executed over and over for as long as the while statement remains true.

    A while loop may not run, even once.

    [CODE=c]int nyet = 0;
    while ( nyet ) {
    ... // this will not execute
    }[/CODE] ...
    See more | Go to post

    Leave a comment:


  • ravenspoint
    replied to Resizing Window
    in C
    - click start
    - click control panel
    - click display
    - click appearance
    - click effects
    - check 'show window contents while dragging'
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...