Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 136: I don't understand the purpose of that calculation. I would think the fastest and easiest way to get a random word from the text file is to first read the entire file into a vector of std::strings, then the program will always know how may words there are. After that, it's a trivel calculation, generate a random number between 0 and the number of strings in the vector. No loops are needed for that. Read the file into a vector when the program first starts so that it doesn't have to read the file each time a random word is needed.

Of course I'm assuming the file is rather small, 1,000 (+/-) or fewer words. If the file is really huge then there are other alternatives that may be better than reading it all into memory at the same time.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is no code -- it was generated by the wizard. I'm using 2013 Pro, don't know if 2013 Express has the wizard or not. It's under the heading vb automation.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Good luck getting 200 text boxes on the same form.

txtb.Name = txtb.Name

Huh? Why are you setting Name equal to itself?

Question 3: What version of vb.net are you using -- I know vb.net 2013 makes it very easy to create excel worksheets, here is an example:

fced9aa485ce9e9b0e3cecf6f0c9e27e

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

i didn't handle firstName and id in struct

Well, add them to the structure.

And there is no lettergrade in input file.

There is in the example you posted. Post the exact contents of the first few lines of the time, not some made-up dummy stuff. We don't have the file so it's impossible for anyone to know what it contains.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do the assignment one small part at a time. First write a program that contains a loop which runs from 0 to 5. Then declare an array of 5 strings. Now your program is ready to prompt inside the loop for the strings, using the loop counter as the index into the array of strings.

Once you have finished that, you are ready for the next part of the assignment -- sorting the array of words. When you get that far, come back and we'll help you with it, assuming you still need help.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You're the one who called yourself a "love" doctor, not me. google "love doctor" and see what you find.

<M/> commented: Hitch... you will find Hitch ;) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Call find_first_of() instead of just find(), as in the example in this thread. In a while loop keep calling find_first_of() until it returns npos. Each time one of the characters is found replace it with something else, such as a space.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Some freezing rain again today.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe he's bragging about how much sex he is getting :) Young men like to do that, whether it's true or not.

<M/> commented: I doubt it +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What compiler are you using? Does it tell you what line the error occurred on? The error message is not related to the tt array becuse that is an array, not a vector.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

oh, I thought you had just the sourcde code. In that case you should be able to link to it the same way you would link to any other external .net function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Visual C++ is just c++, any c++ book will do it. Or do you want a book on how to use the Visual Studio IDE?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since it was written in C# you can't just simply add it to your existing vb.net code. You might try compiling it with C# compiler into a library, then calling and linking the library to your vb.net program. Supposedly you can mix and code written in all the .net languages, but I've not tried it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This seems to be a good source for English grammer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It will depend on the operating system, but for MS-Windows the best program for writing Windows GUI is Visual Studio. That doesn't mean it's the easiest to learn or use. Code::Blocks with MinGW is easier to learn, and for console programs just as good as Visual Studio. Also MinGW is probably better compliant with C++11 standards than Visual Studio.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't see a goto statement -- where is it?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think the rule is : Before vowel sound

Yes, that's how I was taught. For example "an historian" not "a historian". but I've heard a lot of people on TV using a instead of an, which I think is incorrect.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That works only for arrays that are declared in the same function -- it does not work with pointers or arrays passed to other functions (which are also pointers).

A better way is not to use arrays at all but to use c++ std::vector class, which is a like a smart array. But you probably are not allowed to use std::vector yet.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

localtime() returns a pointer to a tm structure. Then asctime() is called to convert the structure into something human readable, although you could do this yourself if you wanted to.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Frankly I find the Home Page listing somewhat confusiong when compared to Recently Updated Articles. They both present the same threads, but those on Home Page sho the last poster's avatar while Recently Updated Articles show the thread starter's avatar. There could be a lot of confusion between these two methods of displaying the same threads.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

According to one post in the thread I linked to, performant has no clear definition, it can mean almost anything you want it to mean.

The useful thing about a word like “performant”, particularly for consultants and marketing people, is that it has no clear definition; it’s another weasel-word, like “premier”.
Try googling for “the industry’s premier” and ask yourselves what those phrases actually mean: cheapest? fastest? most reliable? resilient? popular?
It means whatever you want it to mean, and it makes a product sound better, in some imprecise, unprovable way.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Those kind of errors nearly always means you didn't implement one or more of the class's methods. If you think you did, then it may be a spelling/capitalization problem. The error message will tell you which method you failed to implement.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The instructions are not completely clear -- How are you supposed to determine how much time each transaction takes? Or is that just a random number too?

First you will have to define exactly what each node of the linked list will contain. Each node of the linked list will represent one customer, and you will need to set up two lists, one for each teller. Then get a random number to indicate how many customer nodes belong to Teller A, and another random number to indicate how many customer nodes belong to Teller B. When building the linked lists you can also set the deposit amount for each customer using random numbers as indicated in the instructions.

After you get the two linked lists done, all you have to do is iterate through each list, sum up the depositions, then finally print the report.

No one here is going to write the program for you, so you will need to post the code you have and ask questions about what you don't understand.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Can u just expalin that point?

It was company coding standards that the goto statement should never be used. Most software companies have coding standards that they expect their employees to abide by. Programmers aren't given free reign to code programs any way they wish, but must adhere to certain coding standards. That makes sense because among other things it helps others to quickly read and understand someone else's code. There are no universal coding standards, each company sets it's own.

You can always make a recursion instead..

But recursion should be a last resort, mainly because it's easy to run out of stack space and other memory. That's not to say there aren't legitimate uses for recursion, only that recursion should not be substituted for more efficient loops.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Performant -- I had to google that word because I don't recall ever hearing it. That brought me to this discussion, which is on target with this thread, but was in 2008.

My pet peeve word is "depict" -- a 10 Dollar word for "show". I hate it when some people try to toss around large words when they could just as easily have used shorter and more common words.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Using feof() like that may produce unexpected behavior, such as counting the last line twice. That's why it's better to loop like Deceptkion wrote it.

Is there a reason why your program is reading the file one character at a time instead of calling fscanf() to read an entire line at once?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When I was working a programmer would have been repremanded for using the goto statement. On the otherhand, I saw it used once in Micorosoft source code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

AD, it's been like that for half a year. :)

Actually, this is the first time I bothered to read it, and then only because of this thread. Normally just go directly to the forums without looking at the home page.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Today's Most Active Members -- fades out so that I can't even read the bottom few lines. Was that on purpose?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is c++ forum, not vb.net

when I send file without the received Com, it still send and exit,

What part of that program are you talking about -- which Choice? Sorry, but I can't test your program because none of my computers have serial ports.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But a c/c++ compiler won't look at it that way. It will pass either 0 or 1 as the parameter because it's a boolean expression (true/false).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

rel(this,z==res[count]X1[count1]);

It was probably the == boolean operator that caused the problem

rel(*this,(z=res[count]*X1[count1]));

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you have two computers with the same IP address?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sleet and freezing rain today. I wanted to go shopping, but changed my mind because I'm not in that big a hurry to drive my car into the ditch.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh no! Not another Elvis nutjob :) I don't know why people are so crazy over that truck-driver-turned-singer. He wasn't all that good of a signer, and a horrible actor. The final straw was when he died of drug overdose. Why would you want to memoralize someone like that???

If you want to dedicate your website to someone, dedicate it to Mother Teresa, someone who is worthy of it.

<M/> commented: Yeah... elvis is horrible. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think they teach huck finn in American schools any more becuse it is rather racist.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Besides, I ain't no authority on nuthin :).

nitin1 commented: I am nitin, not nuthin. :D hehe +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to post the first few lines of the text file so we can see what the program is to read.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Delete lines 17 and 24 -- the variable Count is changed by lines 14 and 21

delete line 6 to 12 because the user is supposed to enter those strings.

line 16: You don't need the string Response. Just use the array

Name(count) = Console.ReadLine()

So your program should look something like this:

Sub Main()

    Dim Name(6) As String

    For counter = 0 To 6
        Console.Write("Please write a name: ")
        NameO(counter) = Console.ReadLine()
    Next

    For Count As Integer = 0 To 6
        Console.WriteLine(Name(Count))
    Next

    Console.ReadLine()

End Sub
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's just a simple SQL statement. If you don't know SQL, then you need to read a tutorial on it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem is most likely with the Firewall that's on the computer hosting the database. Change a firewall setting to open up the port your program is using. I had to do that with my own Home Network in order to get a similar program running on my computers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No -- it's just a catchy title, don't take it personally. Just like anything else, practice is the key to success. Read lots of English-written novels, magazines, and newspapers. If you have a nearby library, then visit it often to read. Don't start with Shakespear -- read stuff written in the past one hundred years. Anything earlier (with very few exceptions) will most likely contain obsolete words and phrases, or words whose meaning have changed. And keep a good dictionary handy -- Marian Webster and the British Oxford Dictionary are the most authoritarian dictionaries in the world. Which to use depends on which dialect of English you want to learn -- there are quite a few differences between American and British English.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If the pattern is allowed to use wild card characters, such as * and ? then it gets a bit trickier.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Instead of trying to blaim memory leaks on your compiler you should be looking at your own code for them. Most compilers have been tested pretty thoroughly. In 25+ years coding I think I found just ONE compiler-generated memory leak (in malloc/free functions, and that was over 10 years ago, and that was caused by memory fragmentation).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read the entire file to a string and use string lenght function.

That won't necessarily produce the file size because the file may contain characters that are translated by the operating system. For example, MS-Windows uses two bytes to indicate end-of-line and, when read in text mode, those two bytes are converted to only one byte.

Why would you want to wast so much RAM and time to read the file into memory just to get the length of the file, especially when it's soo easy to get the length without reading the file at all?

The only accurate way to get the file size is to use seekp() to the end of the file, then call tellg() to get the byte position as shown in the example linked by Assembly Guy.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Not sure which of these you want, all three have been mentioned before. Here are three possibilities. Maybe the third option is what you are looking for.

If test is really a pointer to an integer then in order to save it in std::string it has to be converted from int to string. streamstring is how that's done.

void foo(void* test)
{
   int* x = (int*)test;
   cout << *x;

   //or

   cout << *(int*)test;

   // or
   stringstream s;
   s << *(int*)test;
   std::string str;
   s >> str;
   cout << str;
}

int main()
{
   int x = 12;
   foo(&x);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

And Dickens lived in a time when most common people were illeterate. Just because a famous author writes something in literature doesn't mean it's acceptable in conversional or otherwise written English. I know a couple of people who can't say two words without one of them being the F bomb -- I really dislike that, and won't watch stand-up commedians or movies where that word is sprinkled liberally.

George Carlin is probably the only stand-up comedian I can think of who doesn't offend me with his dirty mouth, why? Probably because all his speaches had a point, they were something worth listening to.

GrimJack commented: He put 'ain't' into the mouths of the professional class not the lower classes and he had the voices and speech of his time and place and never use +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

As deceptikon said, C language does not have a string data type. Instead, it uses character arrays. For example if you want it to hold the word "Hello" then the character array has to room to hold at least 6 characters -- 5 for "Hello" and another for the terminating character which is '\0';

char string[6];

This declares a character array named "string" that can hold 5 characters plus null-terminating character. You can name the array anything you want, it doesn't really matter as long as the name is unique (can't duplicate the name of something else in the program).

castajiz_2 commented: tnx for the additional reply +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't see a linked list in the code you posted -- just a couple arrays.

Why do you have a two structures that contain circular references? EDGE has a pointer to VERTEX which has a pointer back to EDGE??? That makes no sense. Maybe you need to rethink the organization of those structures and what they are doing.