CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Philip Nicoletti

Page 1 of 80 1 2 3 4

Search: Search took 0.61 seconds.

  1. Replies
    12
    Views
    5,003

    Re: stl find

    This does not use cache, but one way is to use local static variables
    in the function. They are initialized once and remembered between
    function calls.



    double GetValue(int index)
    {...
  2. Re: In C, bubble sorting causes a garbage value error.

    look at the case when i = len - 1 and j=i
    Then j = len - 1

    you are accessing arr[j+1] = arr[len-1+1] = arr[len]

    which is outside the bounds of the array.
  3. Replies
    5
    Views
    1,362

    Re: Toolbar in MFC

    1) When I created a toolbar on a dialog, I needed to call LoadToolBar() after Create()

    2)
    CToolBar a; is a local variable, so it will go out of scope when the function exits. Maybe it needs to...
  4. Replies
    4
    Views
    2,243

    Re: mfc dialog display problem

    Is your width a multiple of 4? Some systems require that you pad the BMP scan lines to make them a multiple of 4.
  5. Replies
    1
    Views
    2,115

    Re: logarithmic operation

    It looks like you are using a C style printf format to look at the value.
    Probably "%d" .. which is for integers ... use "%e"
  6. Re: not printing true message scanf skipping problem in c.

    You have name declared as an integer (and reading as an integer).
    I suspect you are not entering an integer value for name.
  7. Replies
    13
    Views
    7,766

    Re: [] Operator Overloading in C++

    Simple example:


    class MyClass
    {
    public:

    const int & operator[](int i) const { return x[i]; }
    int & operator[](int i) { return x[i]; }
  8. Replies
    14
    Views
    5,074

    Re: rapidxml

    Just a note: By default, using istream_iterator<char> will throw out whitespaces, which might not be wanted:

    Example, if the file contains:


    <message>Hello World</message>


    the string will...
  9. Replies
    14
    Views
    5,074

    Re: rapidxml

    You can use a back_inserter to read the file in the method you are using.
    I would open in binary mode.



    void CInput::load(char *fullpath)
    {
    ifstream file(fullpath,ios::binary); //...
  10. Re: char [] or char [large size] question

    You can use GetWindowTextLength() to get the length of the window text (or a larger value).
    See the documention.
  11. Re: Migrating code from VS2008 to VS2010

    The VS2010 version is correct. You can't change the values of a set
    since it could change the order of the elements.

    There are a couple of workarounds

    1) remove the element from the set and...
  12. Replies
    20
    Views
    2,831

    Re: eof not working properly?

    Generally, this method is always wrong (since eof() does not become true until after
    an attempt has been made to read past eof):


    while ( !f.eof() )
    {
    std::getline(f, temp);


    Normally,...
  13. Replies
    20
    Views
    13,862

    Re: Sparse Matrix Operations

    1) Since you are using std::vector, you will not need to
    do a "new" to increase the size of sum matrix. You can
    simply push_back() the element.

    2) As a first pass, I would choose a simple...
  14. Replies
    20
    Views
    13,862

    Re: Sparse Matrix Operations

    You have:



    for (int i = 0; i< a.nrElemente; i++)
    {
    Elems el;
    cout << el.Linie << " " << el.Coloana << " " << el.Valoare << endl;
    }
  15. Replies
    3
    Views
    9,196

    Re: -Need Help- Doubling Array(s)

    1) you are missing:



    #include <string>


    2) I am not up to date on the latest standard (I think the definition of POD changed) , but
    it seems like using memcpy on objects that contain a...
  16. Re: error C2106: '=' : left operand must be l-value

    Take a look at your code in post # 2, and consider what would happen if the variable one did not have a 'Q' in it (even assuming you used +=). 2kaud suggestion of using find bypasses these types of...
  17. Re: error C2106: '=' : left operand must be l-value

    Since the variable, two, has a length of zero, I think that you should use operator +=
  18. Replies
    10
    Views
    3,673

    Re: VS 2015 and standard headers

    Try:



    #include <cmath>
  19. Replies
    4
    Views
    1,154

    Re: Variable for a member variable

    You can not copy classes that are derived from CObject (for the reason given in the error message).

    You should be able to use a pointer instead:



    CComboBox * m_cbtheme;

    m_cbtheme =...
  20. Re: Given an array that contains numbers from 1 to 1+n

    Say N = 10 .. The array will have the numbers 1 thru 11 (with one missing)

    1 + 2 + 3 + ... + 11 = 11(12)/2 = 66

    Sum the elements in your array. It will be less that 66, since one number is...
  21. Re: Given an array that contains numbers from 1 to 1+n

    I assume that this is homework, so I'll just give you some hints:

    For (a) : use the fact that : 1 + 2 + 3 + ... + (n+1) = (n+1)*(n+2)/2

    For (b) : do a binary search. Compare the array value at...
  22. Re: Discrete Fourier Transform Test Results

    1) I don't see how you get the output you posted with the code you posted.

    2) The main difference the two outputs seems to be that you divide by the number of points.
  23. Re: Extracting RGB values from Bitmap Image

    It should probably be:



    for(int i=0; i<width*bytesPerPixel; i+=bytesPerPixel) // width
    {
    arrayB_2D[j][counter] = array_1D[offsetx + i+0];
    ...
  24. Re: Extracting RGB values from Bitmap Image

    You did not do anything about one of my comments. Look at the loop:



    for(int i=0; i<width*bytesPerPixel; i+=bytesPerPixel) // width
    {
    arrayB_2D[j][counter++]...
  25. Re: Extracting RGB values from Bitmap Image

    1) What do you mean by: "the program still does not work". Are values incorrect ? Does it crash ?

    2) you need to post your current code.
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4





Click Here to Expand Forum to Full Width

Featured