jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You'll still need to split the strings. ReadAllLines (which I think is new to .NET 4.0) just avoids having to use a loop. You'll end up with one string per line, I believe.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What does DELIM consist of?

The reason you are getting one line is your ReadLine is not in a loop. You're going to have to read in a line, split it in two, drop the label, place the data in the array and move to the next line.

Geekitygeek commented: read in one line, then complain that you only get one line...aah newbies, whatever shall we do with you :p +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What does picgen look like? Changing the background image of the picturebox (which is what it should be doing) should cause a refresh on the control, IIRC.

In fact if you had a uniform wait time in between you could use a timer control.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need to change your project to a Win32 Console project rather than a plain Win 32 project. I'm not sure how to do it within the settings of the program itself, so the quickest way is to probably just make a new project (and uncheck precompiled headers while you are there).

Also, please use code tags [code] //code goes here [/code] to post your code the next time

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Fbody, your line 2 should read myString += " 123"; I believe.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No one is going to give you the code. You'll have to make some decisions about how you'll populate your arrays, whether you hard code the words into each or read them in from a file, etc. You can just search for the words in the array and output the word with the same index in the foreign dictionary. Anyway, take a crack at it and post back with further questions or, even better, code.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Never use gets for input, you can overrun the end of your input buffer and crash your program, etc. Use fgets instead, if you must use the C library functions.

I'm having a hard time understanding how the snippet you posted relates to either getpass or sign_in (I get that you call getpass in it but where is it defined?)

(this sounds harsh but I really didn't intend it that way at all)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See if the content of this thread http://www.daniweb.com/forums/thread27905.html will help you. Basically, you can use a string stream with getline using a delimiter (analogous to using getline with a delimiter on an input stream).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Okay. I'm not well versed in that but hopefully but there are a few folks around that will be able to. Apologies that I couldn't help!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are you using for a windowing library ("...in two text box")? (e.g., Win32 API, MFC, CLR-Winforms, Qt)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You actually don't even need arrays for this. It's simpler if you don't use one.
Look at line 19. It's not really doing anything (especially since scores is an array). What about if you moved that up within your loop and kept track of the sum as you added in each new element.

For the smallest and largest, consider what you would do if I told you that you could hold two pieces of paper, one with the largest number so far and one with the smallest. Now, walk along a list of papers and compare what you have in your hand to the current value. If it's greater than the maximum, pick it up, if it's less than the minimum pick it up. Now translate that into variables and do it in your loop.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Glad it worked!

void main()

You had it right the first time with int main. main returns an int according to the standard.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Classes can have member variables and methods.

class Example //this could just as easily be a struct as both it's members are public
{
    public:
        int exampleint;
        void examplemethod() { //do something }
};

int main()
{
  int num;
  Example ex;
  num.method();  //int is a native type not a class struct or union, can't use the .(it has no methods)
  //the above line would generate a message similar to the one you had, I believe (I didn't compile it and can't remember)
  num = ex.exampleint; //ok we can access exampleint by the .
  ex.examplemethod(); //works as ex is an object of a class
  return 0;
}

However, in your case it is because it is not recognizing the type std::string because your headers are too old (at least that what it seems like).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, but even in that same handout they have you include

#include <iostream>
#include <string>  // != string.h (I'm not sure how this is resolved in pre standard compilers)
#include "genlib.h" //which must be a custom header to go with their course

If you're just starting out and you're not attached to VC++ 6 due to legacy code or needing MFC, grab the VC++ 2010 Express Edition compiler from M$. It's free and is infinitely more standard compliant than v.6.

you’ll need to include genlib.h to make the short name
string visible instead of requiring the cumbersome std::string.

All this means is that the header probably has using namespace std; (or using std::string by itself) so that you don't have to qualify the name (typing std::string instead of typing string, just as you would have to for std::cout, etc) it doesn't have any bearing on anything else.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If this is the same question as your other post please request that a moderator closes this one and direct people to your other one. It's too confusing to have two posts open with the same topic.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hint: within your loop, keep track of the highest and lowest values as they are coming in (by comparison with the existing highest and lowest values). Think about what you need to keep track of to take the average and keep track of that in your loop as well.

Trace the code out by hand for what you need to do and then build a loop out of it using the above information.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You want to include <string> instead of <string.h> to declare it as a std::string which has a length() method (really just an alias for the size() method). strlen() comes in <string.h> (or <cstring> in a compiler that conforms closely to the standard (which VC++ 6 does not)) and is used on null terminated C style strings. How is str_name defined?

That's rather terse but post back for clarification or google for std::string versus C style strings and there should be a ton of hits.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hint: x ^ y takes the exclusive or (XOR) between the bits of the two integers it is not the proper operation. The pow() function of <cmath> is used for that but is not necessary here.

You are correct in needing a for loop. Try and figure out the value of 2 you need at each step (e.g., at 0 you need 2 raised to 0 which is 1, at 1 you need 2 raised to 1 which is 2, etc.) and find the pattern. Trace it out by hand if it helps you. Take another crack at it and post back.

Please use code tags when posting code [code] //code here [/code]

Fbody commented: well handled :) +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
DateTime dt = dateTimePicker1.Value;
TimeSpan ts = DateTime.Now - dt;

Then use ts.TotalDays to do your calculation.

Please Please Please eaplain me...

No need for this.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are the values that you are putting in the comboboxes? Rather than use Convert try using

Int32.Parse()  

or

Int32.TryParse()  

and check the values before you put them into the DateTime constructor. I'll have to check if the DateTime constructor makes sure that the date is in a reasonable range.

Also, why not use a date/time picker instead of your own comboboxes? It gives you data in the right form already and you can use the TimeSpan object to get the difference between the dates.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was able to do it just using the maximum of the data set but sorting certainly works for that too. Someone gave the OP a turnkey solution in one of his other threads :( (I did not test it) so we'll see what he/she reports back.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Start your own thread with your code and someone will help you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You have a set number of lines corresponding to the maximum number. If the count in your int array exceeds a certain criteria print a star, doing this for each index of the array. Take a stab at it, you'll probably come pretty close and post back if you have problems.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please don't type in all caps no need to YELL lol.

What's the problem with the program? Is it not giving you the result you expect or are there errors? Please be more specific.

Please place your code in [code] //code here [/code] (it's not too late to edit your post).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Post something on this one saying continued in C# (so you don't get posts on both threads) and then repost it over in C# (with code tags this time please [code] //code goes here [/code]). Ordinarily you shouldn't post it multiple places but since no one has moved it that might be the best option. A mod can probably merge them later.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There is a forum dedicated to C#. This is not C++ code. I have flagged your post to be moved there by a moderator.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Unless you have to use it for some reason (it's nearly 20 years old!!) go for Visual C++ Express Edition or Code::Blocks

If you're stuck with it, search in this forum or the C forum for directions on getting it to work (the C forum posts will be related to Turbo C but it's the same concerns). Example: http://www.daniweb.com/forums/post1281354.html#post1281354

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I cannot speak to the quality of this site or their code but if you go to
http://ligarto.org/rdiaz/Software/Software.html, the Pomelo package seems to have what you are looking for (get the "Download the source code for the statistical tests" package).

That Apophenia library seems to have a lot of dependencies if you don't have the Gnu Scientific Library or SQLite it probably barfs on you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I've sprouted an aberrant "week of July 14" (a Wednesday) bar in between July 11 and 18th on my graph in addition to the wacked out "week of January 3" one at the end. Again, not a problem personally for me but I found it strange and wanted to update.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I had suggested in the "Who Does It Better" thread that she change it to a MSDN type approach where people can propose a particular answer or answers as a solution and the OP has the final veto power. Moderators can approve an answer after a period of time if the OP takes off. That way everyone gets the credit and there's no tangling up of who solved what.

Of course a system like that makes more work for coding the site and more work for mods but it addresses these concerns.

(Just figured I'd reiterate since it was pertinent)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I would make 2 arrays, one holding numbers and one holding counts corresponding to the numbers. If you want to process the number at each entry, check and see if the number exists in numbers array. If it does, increment its corresponding count, if not add it to the numbers array.

Changing it to read all the numbers in at once and then process them wouldn't be too difficult.

EDIT: Agni nudges me out by a hair

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

One of what, LOL?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

A couple of hints:
Call srand((unsigned)time(0)); once and only once at the top of main (or anytime before your first rand() call but top of main is a good place).

To get numbers in a range 0 to maxvalue inclusive use rand() % (maxvalue+1) (not the ideal way but the simplest -- read http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx for some much better options).

You don't get anything out of using your ifalpha function. isalpha() already returns a bool so just use it in an if statement.

See if you can figure out a way to output your random letter just using that rand() % 26 gets you a number between 0 and 25.

Try those suggestions out and post back...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Which code?

For the second problem, btw, you just need the MouseHover and MouseLeave events for the picturebox, changing the background image to picture2 on MouseHover and changing it back on MouseLeave.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

http://www.augustcouncil.com/~tgibson/tutorial/iotips.html Scroll down to "Reading in numbers directly is problematic" There's a few other sections in there that are useful to you too.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need the arrow -> and not the . on lines 15 and 16 because theTime is a pointer.

shaynerossum commented: Thank you very simple solution. +2
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm not going to have too much information to give you, unfortunately. I would think that this is an area more for embedded logic on routers. I couldn't begin to tell you what the predominant language is in that kind of situation. Hopefully someone else will know more.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm not sure about what you are asking. Please be more specific. Even better, post the specific code with which you are having trouble.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What is the type of var in your above code? The <algorithm> versions are not member functions of an object as normally they take iterators to objects as parameters. That's why I'm confused as to where var is coming from. I misread it initially.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think the OP is getting at being able to tell if the user has entered a number or not.
One way to do that would be to use the .fail() method of the input stream. You could also probably use stringstreams.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

For example,

if(x >=1 && x <=5)

will work

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Here is what I was able to creat so far...It works but I know I will have to fit it to 2 seperate classes.

using System;

public class UseFactorial
{
   interger CalculateFactorial = new interger

}

Not a bad start. Take a look at your specification, it says the method should be CalculateFactorial not the class. You could conceivably keep Factorial (a class with member CalculateFactorial) in Program.cs with Main() but I would keep it separate. Make them separate files even (keeping the namespace the same). So right-click on the project name in the solution explorer and click Add...class (if you've done this already all the better).

Take another crack at it and post back with what you have.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Since you're new to programming, I will tell you some programming tips:

-Try to indent your code (inserting tabs or spaces when you're between brackets).
It will make your loops (for), your conditions (if) and all your code more easy to read and understand.

A very good point.


Additionally, putting your code in:

[code]

//code here

[/code]
will preserve the formatting of your code in the forum, otherwise all leading space is stripped from the post.

ddanbe commented: subtle :) +7
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What have you tried so far in code? Can you create a project that has 2 (empty) classes in it?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try it exactly the way the compiler is telling you with the namespace and class qualifiers. Otherwise I am not sure.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Did you try what the error message suggested to do? It's telling you you needed the pointer and how to add the & to the function to do it (I have limited experience with threads under C++/CLI but it seems logical as this function pointer is like a delegate).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can you use CMake to generate a Visual Studio project for it? (does it have a CMakeLists.txt in the main directory)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Is there some reason why you have two main()s? That doesn't make any sense. What does the beginning part have anything to do with the problem?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The find() in algorithm is completely independent of find() in string. find() in algorithm should be able to be used on any STL container (including std::string if I am not mistaken). The find() in string can only be used from a string object and takes different kinds of parameters as overloads (see those references I posted).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Go to Control Panel
On the left hand side go to Settings and Options/Edit Options
Scroll down to Messaging & Notification
Under Private Messaging check "Save a copy of sent messages in my Sent Items folder by default" (this setting is unchecked under the default setup, I believe)

I can't speak to how you would check whether or not the message was actually sent without having the sent folder.