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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.13 seconds.

  1. Re: error: expression must have a class type

    The comparison should be quite simple: at the core of bubble sort is the comparison of adjacent elements, and that comparison does precisely that.

    The loop condition might be a little harder to...
  2. Re: error: expression must have a class type

    Exactly. Notice that the two examples are effectively the same: other than in the first line, every instance of the name arrCopy from example 1 has been substituted with arrOrg in example 2, and...
  3. Re: error: expression must have a class type

    Actually, I'd say 2kaud is "wrong" as the two possible ways listed are actually just one way:

    If you copy the original array and sort the copy, then you need to re-copy the original array before...
  4. Re: error: expression must have a class type

    Well, you need to understand:

    The notion of scope and local variables.
    The notion that formal parameters are local variables, and that parameter names need not match the names of the actual...
  5. Re: error: expression must have a class type

    Actually, 2kaud wrote that in post #19. It is a repeat of what I wrote in post #18, i.e., you passed arr as the argument to selectionSort instead of passing arrCopy, and consequently arrCopy remained...
  6. Re: error: expression must have a class type

    Notice that you called selectionSort with arr instead of arrCopy as the argument.
  7. Re: Selection Sort is not magic! What's going on?

    Upon encountering 7, 7 becomes the new smallest known element, so by the time 5 is encountered, 5 being less than 7, 5 becomes the new smallest known element.
  8. Re: error: expression must have a class type

    Yes, but it is not so much reusing: for example, you could name the parameter elements, data, values, numbers or some other generic name for an array of numbers and it would still work. You could...
  9. Re: error: expression must have a class type

    True, but that does not mean that you have not declared pointers. This:

    void copyArray(const int arr[], int arrCopy[], int n);
    is equivalent to this:

    void copyArray(const int* arr, int*...
  10. Re: error: expression must have a class type

    Look carefully:

    for (int i = n; i < n; i++)
    Oh. and the first parameter of printArray should be a pointer to const int, not a pointer to it. As I mentioned earlier, it is the definition, not the...
  11. Re: error: expression must have a class type

    Notice that you declared printArray as:

    void printArray(const int arr[], int n);
    But when it came to defining it, you wrote:

    void printArray(int arrCopy[], int n)
    The const makes a difference...
  12. Re: error: expression must have a class type

    Refer to the parameter declaration: const int arr[]

    Therefore, in this context, arr is a pointer to const int, so you cannot assign to it. This is a Good Thing because, according to your comment...
  13. Replies
    2
    Views
    207

    Re: Reading text file into Array

    You should avoid global variables. Rather, you could have written in the global main function:

    ifstream FileIn("F:\\values.txt");
    ofstream FileOut("F:\\arrayOutput.txt");

    This is wrong because...
  14. Replies
    49
    Views
    959

    Re: .xml to .txt

    I think you missed Arjay's point though, i.e., that if it were a school assignment, the exercise would not be a waste of time since the student would be learning through practice, even though the end...
  15. Replies
    49
    Views
    959

    Re: .xml to .txt

    Your hopes have been partially dashed:

    Only partially though, because it might be a personally assigned exercise from a book or something rather than school or work.
  16. Re: error: expression must have a class type

    This is wrong since arr is not an array of char, signed char or unsigned char:

    const size_t size = sizeof(arr);
    Compare with the example from my previous post.


    You're still not calling the...
  17. Re: error: expression must have a class type

    You wrote: arr.size() but arr is an array. One way out is to change arr.size() to size then set size just after declaring the array:

    const int arr[] = { 0, 1, 2, 3, 4, 5, 99, 6, 7, 8, 9 };
    const...
  18. Replies
    49
    Views
    959

    Re: .xml to .txt

    Is this a school assignment? What if you used a properly licensed third party library that only depends on the standard library?
  19. Replies
    49
    Views
    959

    Re: .xml to .txt

    I agree, but refer to my post #8 and flex567's reply in post #9. I suspect that this is a school assignment with a guaranteed precise format such that flex567 does not have to worry about this, and...
  20. Replies
    49
    Views
    959

    Re: .xml to .txt

    No, I am saying that you should not do that. Rather, you should just parse the file, even if it is just 3 long lines. This can be done by say, reading chunk by chunk.


    Since you are not permitted...
  21. Replies
    49
    Views
    959

    Re: .xml to .txt

    Refer to my post #12. There is indeed a way for you to transform from one to the other, but that way involves parsing the XML document... which is precisely why you want the second format to begin...
  22. Replies
    49
    Views
    959

    Re: .xml to .txt

    Post the contents of both example files here in
    bbcode tags and explain what exactly is the difference between them. Note that "easier to parse" it is not a difference that matters to us: what...
  23. Replies
    49
    Views
    959

    Re: .xml to .txt

    Okay, if I get this right: you have an XML document that you find hard to parse with getline. You want to transform it into a ".txt file" that is essentially the XML document formatted nicely for you...
  24. Replies
    49
    Views
    959

    Re: .xml to .txt

    Why don't you just use an existing XML parser library?
  25. Replies
    49
    Views
    959

    Re: .xml to .txt

    So what are you saying? Sorry, but the image you linked to is too blurred for me to make out what you are trying to do.
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center