deceptikon 1,790 Code Sniper Team Colleague Featured Poster

All the time I misunderstood the words? >_<

Seems like it. Better here than in a professional setting though, right? That's happened to me an it's mighty embarrassing.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

While RLE is pretty straightforward, the encoding of the result can vary. So it's difficult to answer your question without knowing what kind of encoding is being performed to achieve that result. Where did you get the example?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

@NP-complete, the word inclusive in pseudo code means you do not include the value in your range.

Actually, it's the other way around. Exclusive means that an end of a range is not included and inclusive means that an end of a range is included. The square bracket means inclusive and the paren means exclusive, so:

[a,b] - Fully inclusive, closed
(a,b) - Fully exclusive, open
[a,b) - Half open, excludes b
(a,b] - Half open, excludes a

Or in other terms, [a] represents the set {a} while (a) represents an empty set {}.

What I said means [1, array_size).

What you said means [1,array_size], which is congruent with the usual pseudocode interpretation. If what you meant was a half open range then it would be closer to:

for each index starting from 1 up to array size - 1

If it is exclusive, it means the value will be included in the range.

I find your explanation hilarous given that include and exclude are opposites. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It works fine on my end. What numbers are you typing? What compiler and OS? As Nathan asked, what does "it just stops" mean?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

and how i check indexes and size

Do you know how to run the debugger?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Android isn't a language, it's a platform.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Do you have any rows in the datagridview? Hop into the debugger and check your indexes as well as the size of each collection being indexed.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

alwyz not solve

Post the error.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Those characters are interpreted as HTML. Wrap the code in <pre> or <code> tags and replace those characters with their HTML escape codes if necessary (ie. &lt; and &gt;).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

sigh

The var keyword was introduced 5 years ago. Unless you're specifically maintaining legacy code, upgrade your tools! But since I know you won't, this will fix that error:

DataGridViewRow row = dataGridView1.Rows[e.RowIndex];
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Something like this comes to mind as a first attempt:

#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>

int main()
{
    std::ifstream in("test.txt");

    if (in) {
        std::string header;

        while (getline(in, header)) {
            if (header.empty())
                continue; // Discard empty lines

            int changes = -1;

            if (!(in>> changes)) {
                std::cerr<<"Invalid file format\n";
                return EXIT_FAILURE;
            }

            for (int i = 0; i <= changes; ++i) {
                int distance, speed;

                if (!(in>> distance >> speed)) {
                    std::cerr<<"Invalid file format\n";
                    return EXIT_FAILURE;
                }

                std::cout<< header <<": ("<< distance <<','<< speed <<")\n";
            }

            std::cout<<'\n';
        }
    }
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

@deceptikon: just trolling :P

Then you don't need anymore help? Awesome, that frees up some of my time for more productive pursuits. Thanks!

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I've tried your code but all it does is display question marks in the console!

You're trolling me, aren't you?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's easy to perceive rudeness from someone who's trying to help, especially if they tend to cut through the bullshit and tell things like they are. If you think someone is really acting out, please report the post so that a moderator can deal with it. Creating a thread like this just comes off as childish and petty.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It doesn't work since pasting those symbols in Dev C++ only pastes question marks.

Woohoo! And we've come full circle. Yes, it works fine. Dev-C++ just doesn't know how to display those characters. Did you read anything I've typed in this thread?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

u'9812' (C++11 only) or L'\x9812'. The former is preferred if supported. Some compilers also offer a unicode escape such as L'\u9812'. For multiple characters use the string variant L"<character codes go here>".

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Presumably the language required by your mobile platform. For platforms that support multiple languages, choose the one you're most familiar with. If you're not familiar with any of them, I'd suggest using the one that's most pervasive as it'll be easier to learn and get support on.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can you send me a sample code for doing this task?

Since you clearly didn't find the obvious code examples on the links you say you read, here:

#include <wchar.h>
#include <windows.h>

int main()
{
    const wchar_t *white = L"♔♕♖♗♘♙\r\n";
    const wchar_t *black = L"♚♛♜♝♞♟\r\n";

    WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), white, wcslen(white), 0, 0);
    WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), black, wcslen(black), 0, 0);
}

Shall I assume that your next complaint will be that you're seeing nothing but question marks or squares in the command prompt? Because that would take us full circle on your complete failure to comprehend all of the useful information you've been given.

including the libraries..

They're all built into the compiler.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How to change font to Lucida Console Unicode?

Right click on the console window and choose Properties. From there you can change the font.

If i try to just copy/paste the character (like ♔) in Dev C++, there appears '?' instead of '♔'

Yes, that's what happens when the output medium (the text editor in this case) doesn't support Unicode or uses a font that doesn't support the character.

There must be a function for UNICODE like char(x) is for ASCII

Yes, it's called a wide character or string:

L'<character goes here>'
L"<string goes here>"

But that has exactly nothing to do with your problem, which is configuring the output device to handle Unicode. Did you read the link I gave you?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

sorry but i have no time. >.<

You probably had time, but dicked around to the point where you don't have time. That's entirely your fault and quite frankly, getting burned by procrastination is a fantastic way to learn the benefits of time management. I subscribe to the school of hard knocks, so I'll refrain from helping you on this. Maybe someone else will be more charitable.

Begginnerdev commented: Yep +6
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Im just a beginner so please keep it simple for me

The problem is that it's not simple. You can tell C++ to write Unicode characters until you're blue in the face, but if the console isn't set up to support Unicode or using a font that supports those characters, you won't get the correct output. It's more of a limitation of the command prompt than C++.

I'd suggest using Google, but this page is a good starting point as well. Note that cout/wcout correspond roughly to printf/wprintf.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

By default std::sort() uses operator< to handle the relation between items. Since you have neither an overloaded operator< nor specify a custom comparison function, of course it doesn't work.

Consider using the three argument version of std::sort(). You can find details and examples here.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm baffled by all of the people who manage to reach their thesis yet still have no clue how to come up with a title for it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

unresolved external symbol "public:_thiscall TREE::TREE(void)" (?? 0TREE@@QAE@XZ) referenced in function_main

I don't see a definition for your default constructor, which your compiler seems to agree is missing. So I'll go out on a limb and say that you forgot to give it a body and need to do so to fix the error.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

now I'm getting two other errors:

Which you neglected to post.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

THE ABOVE CODE DOES NOT RUN USING DEV C++ WHAT SALL I USE TO RUN IT?

At a glance it doesn't look like the code uses anything that Dev-C++ shouldn't be able to handle. What errors are you getting?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Finally, you might want to consider using std::copy as an alternative to memcpy, the syntax is nicer, there's some kind of type-safety in there and I don't think that there's any real efficiency difference between them. std::copy can actually be faster in some circumstance

I'd be shocked if std::copy() were more efficient when copying non-POD types because it guarantees that constructors are called and all the nifty stuff that makes C++ work happens. For built in and POD types the compiler will likely optimize to the point of being competitive with memcpy() if not equal to memcpy(), but I have trouble believing that it could ever be faster. memcpy() just blindly copies bytes, usually in the most efficient way possible for the platform. The definition of std::copy() isn't conducive for the optimizations that memcpy() is capable of.

What's really terrifying is that memcpy() on non-POD types:

  1. Doesn't call constructors.
  2. Doesn't respect the structure of class hierarchies.
  3. Is technically undefined behavior.

Therefore, use of memcpy() is considered a bug for all but built in and POD types. So you kind of ended up at the same suggestion I'd make, but for different reasons. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

how?

The same way you got data into the datagridview in the first place.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

SelectedRows won't necessarily be populated from a cell event. You could use SelectedCells[i].OwningRow to get your "selected" row and attached cells:

private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
    var row = dataGridView1.SelectedCells[0].OwningRow;

    guest_id.Text = row.Cells[0].Value.ToString();
    first_name.Text = row.Cells[1].Value.ToString();
    last_name.Text = row.Cells[2].Value.ToString();
    txt_gender_status.Text = row.Cells[3].Value.ToString();
    txt_martial_status.Text = row.Cells[4].Value.ToString();
    phone_numb.Text = row.Cells[5].Value.ToString();
    email_id.Text = row.Cells[6].Value.ToString();
}

But I mention that only because it's handy information. In the context of a cell mouse event, the event args give you the row index, which is a vastly superior method:

private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
    var row = dataGridView1.Rows[e.RowIndex];

    guest_id.Text = row.Cells[0].Value.ToString();
    first_name.Text = row.Cells[1].Value.ToString();
    last_name.Text = row.Cells[2].Value.ToString();
    txt_gender_status.Text = row.Cells[3].Value.ToString();
    txt_martial_status.Text = row.Cells[4].Value.ToString();
    phone_numb.Text = row.Cells[5].Value.ToString();
    email_id.Text = row.Cells[6].Value.ToString();
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Um...what? So you're trying to traverse an array with a do..while loop in forward order?

int i = 0;

do
    Console.Write(array[i] + " ");
while (++i < array.Count);

Or if you can't have a counter starting from 0 and must have a descending counter starting from array.Count, the difference of the counter and array.Count will give you what you want:

int i = array.Count;

do
    Console.Write(array[array.Count - i] + " ");
while (--i != 0);
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

well I didnt give it a value

Bingo. So the actual value it has is whatever random garbage was in that memory location. Chances are extremely good that you're indexing the array out of bounds.

I just thought that num would be the numbers I am reading from the file.

That makes no sense at all. num is used to index the list array. It's the array that holds the numbers you're reading from file, so I'd expect something like this:

int num = 0;

// Read up to 50 numbers from the file
while (num < 50 && infile >> list[num])
    ++num;

// Display the read numbers
for (int i = 0; i < num; ++i)
    cout<< list[i] <<'\n';
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What are these variants?

They're intuitively named, like B+Tree or B*Tree. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What's the value of num?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If m is even, during splitting, we can choose to keep an extra key in either of the nodes right?

Of course.

And the minimum number of keys in a non-root node would be floor((m-1)/2). Correct?

That depends entirely on the variant of a B-Tree you're using. There's more than one, and the defining characteristic is often the amount of minimum/maximum fillage.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Is that really true?

The powerpoint says that the number m should always be odd, not that it must be. Hopefully the course that the powerpoint supplements would cover the reasoning for that. I assume it's due to simplified splitting and merging algorithms.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Start with spelling and grammar. All the technical knowledge in the world won't get you a job if your level of communication is only competitive with pubescent girls texting on their smart phones.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Unfortunately, it would have to be even more complicated that that. You have to be able to intelligently ignore // when it occurs in quotes

That was already mentioned as an edge case. ;) But the example is helpful for making it clear what would happen.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

then what's the workaround for unix?

Workaround for what?

As concerns the original problem, I'm all but convinced that it's due to in_avail() being completely unreliable for the purpose of flushing the input buffer. The workaround in that case would be to use the correct solution in the first place, which I highlighted in my first reply. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

the link "irc.daniweb.com" is not working.

It's not a website, it's an IRC server. You need an IRC client to access it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So what I'm reading is that you want to get credit (in e-peen points) for solving your own problem, and possibly even deny credit to others because they failed to solve your problem?

p.s. Yes, I'm trolling you a bit with that second part. Yes, I'm a bit of an ass. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Not enough information. The only thing that might be a problem in the code you posted is &theArray[10] potentially being an out of bounds index.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Could you be a little more specific as to what exactly the error is? All I see is code and vague references to "something's wrong".

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

We've had an IRC channel for ages and ages, but nobody cared to use it even when it was linked directly on the forum. If you're interested it's irc.daniweb.com, channel #daniweb. But be warned, there's very little activity, so you'll no doubt find it boring there too.

We're also looking into some form of chat as a new feature.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

but it literally FELL APART.

Literally? Wow, I would love to have seen that happen. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Did you try ignoring the \r as well?

That accomplishes nothing. Regardless of the newline configuration on the system, it will be appropriately converted by the standard I/O library such that the only thing you ever see is '\n'.

On Unix it's a non-issue anyway because '\n' is the native newline configuration to begin with. Other systems like Windows (which uses CRLF or "\r\n") and old Mac OS prior to version 10 (which uses '\r') do a little more work.

As an example of how the standard library works, here's a buffer filling routine that does newline compaction for text mode streams on Windows (starting at line 965). It's for the C standard library, but C++ does something similar way under the hood. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

"KML" isn't a meaningful integer value. Presumably since the ID cannot work as an int, your only option is to return a string.:

public string getRandomID()

The function also doesn't return a value in all execution paths. What if value doesn't match "Men Formal"?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Click Here.

and is tt there a concurrent access to binomial queue

Not natively, no. But you can write your data structure to support concurrency.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It must be nice to have a job where you can ask other people to do your work for you. :rolleyes:

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I answered my own thread and marked the thread as solved but it gave another user (which really didnt help at all) the "solved post".

Everyone who replied prior to the thread being marked as solved gets credit for participating in a solved thread. We're aware that unhelpful people will still get an increment on their solved threads metric, but things tend to balance out such that a completely unhelpful member can't get a high solved threads count without also being given a lot of negative votes/rep.

As far as the list of names on the solved bar, the author of the thread isn't included as there's an implicit assumption that in asking a question they won't also answer it. The same goes with the solved threads count; your count doesn't include threads you started.

How can I select who and what post solved the thread?

At present there's no feature for marking a single post as being the solution, aside from voting and adding reputation to that post, of course. It's in the cards, just not implemented yet. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

That usually only happens when you're trying to open or copy/paste files that were written on another system or with a less than friendly text editor. Does it happen when you write code directly in Code::Blocks?