jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Why, at this rate there are like only a hundred or less members a day

Wait until it becomes exam time at the universities. I couldn't quantify the surge, but there definitely is one.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Thanks Josca. Do you think i should mark this thread as solved or get more response from other posters to see whether they want a chat room

That's totally up to you. If the matter is resolved, mark it as such, but there's no penalty to leaving it open a bit longer.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

To get your message, go to the upper right hand corner of the screen, next to where it says your name, and click on "Private Messages". To send one, go into someone's profile (clicking on their username in a post), at the lower right hand of that screen it says "Send a private message to <username>" It's not like AIM, but you can get going back and forth pretty quickly.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

They can already "chat" via PM. I think your ideas have some merit, but it takes a lot of programming effort to add in that kind of functionality. The increased server load that would occur would probably be significant.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I still get errors with that, even when I try to compile on the command line.

Invoking g++

FriendClass.cpp: In member function 'void FriendClass::changeMyVariable(MyClass*
)':
FriendClass.cpp:15:8: error: invalid use of incomplete type 'struct MyClass'
FriendClass.h:6:7: error: forward declaration of 'struct MyClass'

Within C::B

obj\Debug\main.o||In function `main':|
|9| undefined reference to `FriendClass::FriendClass()'|
|11|undefined reference to `FriendClass::changeMyVariable(MyClass|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 3 seconds) ===|
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I may have to recuse myself from this one and learn from whomever gets it right, because I've tried darn near everything. This is one of those "circular" situations where they both depend on each other (since you have the variable in FriendClass being passed as a reference to MyClass, and of course the friend function going in the other direction.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

@Jonsca : I'm compiling it using IDE - Code::Blocks. But what difference it makes

If you were doing it on the command line the order of the files can matter. Let me pull your files into a project and see what happens.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

How are you compiling these? As a project in an IDE or on the command line?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need to "forward declare" FriendClass at the top of MyClass.h. On line 6, put class FriendClass; . This tells the compiler that such a thing exists so it doesn't complain when it runs into the symbol in the MyClass declaration.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

BTW, you're missing an eq2 on line 78.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Already a chat room available and has been for a long time.

He's talking about the IRC. You can chat about anything there, it's not just for tech support.

If you're asking about something that you can talk head to head with someone, you could put your Yahoo/MSN/yada in your profile (with the control panel) so people can see it. I would speculate that something like that on any site would take up a lot of server overhead.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, it looks good, but as I suspected you're missing a head pointer. It would be just like NIL except the "tail" of it would point to the first Cons. You can't start at NIL because NIL doesn't have a pointer to the prior node.

|h |->|  |->|  |->|N |
->can only proceed ->

(this is why doubly linked lists were invented, so you could traverse from either end).

That's probably more abstract that you bargained for, but give it a try and see how far you get.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Why has suddenly the thread turn into a thread that discuss misquotes.

I was just righting a wrong. lol. No, I had forgotten who said it, too. It's just for the historical record.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you don't have a limitation, you should post the code out in the forum so that everyone can learn from it. It's against the site's policies to help through PM, anyway. :)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's what I'm saying, there already is an IRC channel for the site. See what they say, I don't speak for anybody, but it would probably be redundant to have two (since the IRC is unfortunately underused anyway).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can I use to "reimp" and "dlltool" to convert the lib file into a .dll and then use it through MINGW?

I've never done that, sorry. I'm sure there's someone around that has. A lot of the libs I use, I end up using with Visual C++ because I've found it to be the path of least resistance. I'll post back if I run into anything, though.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Someone has apparently heard your request and started one moments ago on IRC. ;) (I can't take the credit, it's been there already)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are eq1 and eq2 equal to before your loops start?

A head pointer should have been a fundamental part of your design, what pointing to the first node of your list now? Set eq2 to whatever the beginning of your list is.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You're welcome. I'm willing to work with you, but I'm not going to give you the answer. This is like assignment #1 of a course, so you need to be able to take what you learned so far and apply it, otherwise it's going to be a long painful road for the remainder. I'm not trying to be harsh, just trying to help you learn how to learn the material.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Change the inner loop to for(eq_2 = head; eq_2!=nil; eq_2 = eq_2->tail) (substitute whatever your head pointer actually is), that way the second loop gets reset to the beginning of the second list. I think that's what you're trying to do...please clarify if it's not.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Suppose n is the number you're looking for. Then:

const char alphabet = "abcdefghijklmnopqrstuvwxyz";

I'm assuming you meant const char * here?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

This technique works on most computers in use today, but it is not actually guaranteed to work. That's why I coded my example the way I did.

Very good to know, thank you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
if(number is even)
   do this
else
   do this

I've given you way too much already.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Think of the letters as having a place value, 'a' = 0, 'b' = 1, so "aa" is 0*25+0, "ab" is 0*25+1, "zz" is equal to 25*25 + 25 (check my math, lol).

To get the value of a character, subtract 'a'.

EDIT: arkoenig's got it (and in much nicer form)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

To start down this road, check out http://www.winprog.org/tutorial/ (it's not going to answer your questions right away, but once you get going you'll understand what's going on).

P.S. This thread is ancient. Sometimes better to let them rest and start a new one.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Take a few minutes and think about it a little bit- how could you conditionally increment a variable?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

platform specific implementation

make system calls portable

If something is platform specific, then by definition it is non-portable.

Just skip the "cls", it takes away control from the user and can, IMO, become annoying. If you need that kind of control, use a portable library like pdcurses.

This thread is over 2 years old, by the way.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

break; on 19 and 21 is taking you out of the loop completely, what you want to do is increment k and continue; . Also, you employ something like http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes because you're only testing for 3 factors.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

5 is an odd number, 8 is an even number, how can you determine if a number is odd or even? Look into the modulus operator(%).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What is the actual assignment? Those are very large numbers to be using fundamental types. Perhaps your instructor wants you to implement a "BigInt" type class using arrays.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Stalin said that "religion is the opiate of the masses", but in our society that place has been taken by crackpot "supernatural phenomenon" and conspiracy theories.

It was Karl Marx. Lenin said something like it later on. http://en.wikiquote.org/wiki/List_of_misquotations

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I looked around and ended up with the same information that you did, but read this http://cboard.cprogramming.com/c-programming/55152-trouble-strndup-function.html (especially the post from Salem) about the compiler switch -ansi being incompatible with the non-standard functions (you don't use any switches in your example above, but I didn't know if the server had a different setup)).

If you go into your schools include directory, you can open their string.h and make sure the declaration is actually in there (I don't remember the directory structure on *nix, I think it's something like /usr/local/include, but don't quote me on that).

Failing all that, as the thread also recommends, you could roll your own out of standard library functions.

P.S. It's not very polite to bump your thread

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Check out something like http://www.codeproject.com/KB/IP/csmtpconn.aspx. I've never used it, I just ran across it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Is it a sort you are looking for? Please try to be as clear as possible tnx guys for d help. any help. pls. im needing dis for my defend. sounds like your texting your friends instead of asking colleagues for help.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was saying you have to do both equally well (maybe with a slight imbalance towards the big picture ideas, depending on the subject of the course and your university or school). Later on down the line, you can look up the facts in a book (or online!) but the big picture concepts stay with you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Train yourself bit by bit to also appreciate the "big picture" ideas. What is it telling you about inheritance? What are some of the relationships between classes? If you focus too much on the minutiae, you'll miss the overall point, which is the thing that is likely to be tested in the university.

The little details are important, too, as you said for some situations when interviewing, but you're not going to be able to remember all of the details forever. The concepts will stay with you and be timeless.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You are correct in that two main() functions would not be viable.

Yes, sorry, I misunderstood, I thought you were trying to get the one file bootstrapped, built a reduced makefile out of it, and then continue on with the other portion later.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, you're totally correct as usual, Vernon. Good example. For whatever reason I was thinking he was redeclaring the ifstream object rather than just opening and closing the same one. Sorry.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I don't get any kind of error

2336
Pencils4.5510
1234
Stockings12.3923
0
406.048
0
-406.048Press any key to continue . . .

Just some issues with not having newlines at certain places.

Your counter is going unused in this version, which is probably okay. You can probably check to see if infile is null (if so, you've run out of file) rather than counting. Check into what Vernon was saying, too. My thought is that by reopening the file you're resetting the stream, but test that out (using an infile.clear() to reset it).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What does str contain on line 19?

It seems like you are just guessing at what to code at this point. I'm honestly not sure how to direct you so this makes sense to you (as I'm not going to do it for you). I did specify that your looping and checking should come after the forming of the lines. Does it make sense to do so before? Especially when str is empty...

While(take in char)
{
   if the char is a '\n', this is a complete line, add it to our array and clear it
   
   else, tack it onto the end of the line.
}

for(over all of the lines of the array, i)
{ 
   if(string[i] contains str2)
      print it out
   [otherwise, do nothing]
}

Go through the different steps and convince yourself this is a logical way to do things.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need at least an

[B]int main(void)[/B]
{
   return 0; /*else compiler complains about falling off the end */
}

Probably can trim out some of that, but this is a safe bet

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Okay, thank you. So what you need to do is select the "1" rather than the "Matt Whitehead" because there's not way for the compiler to get an array index out of "Matt Whitehead." It seems like the other routine you posted is doing that very task, though.

When you try to set:

OpenStaff->txtName->Text=FirstName[int::Parse(_selectedName)];

int::Parse is trying to extract a numerical value from "Matt Whitehead" and failing.
Even if it could parse the string, you'd be trying to take the "Matt Whitehead" element of FirstName, which does not work in C++ (it might work in Javascript or PHP).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No, there's a setting under both C::B and VS (but if you were compiling from the command line you could add the switches)

In VS2010: ProjectMenu/<projname>Properties/Configuration Properties/CC++/WarningLevel change to /Wall (I'm not sure what the difference between W4 and Wall is) -- I think this changes it for the project, not sure how to do it globally.

In C::B (v. 6931) Settings/CompilerDebugger/GlobalCompilerSettings/CompilerSettingsTab/ 4th option down

iamcreasy commented: Thanks :) +2
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It matters what's in it:

"23" -> okay, easy to get 23 out of this using parse
"23restofstring" -> can't get out what we need -> throws exception
"restofstring23" -> same deal, can't get what we need ->throws exception

If you string is either of the last two cases, parse is not going to work on it.

Until we confirm what is in the string, we can't go any further. Once we know, we can truncate it to get the number out of it and parse that. I refuse to play games, either you figure out how to get access to that value or I will not be able to help. Period.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use -Wall (for gcc) or /W4 (for VC++) as a compiler switch to turn on the highest warning level. With lower warning levels set, the compiler suppresses warnings it considers "less serious." You should almost always compile with the highest setting.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Then make an additional text box on your form (temporarily) to display that value. I'm really absolutely certain that's where the problem lies, but if you can't tell me what _selectedName is before those int::Parse calls, I'm not going to be able to help you. I'm not sure why you are fighting me on this, these debugging steps are a critical part of the process.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, because if _selectedEmployeeID is a string with just a number, int::parse is not going to have any problem with it.

What do you mean "it doesn't work"? It wasn't meant to fix the problem, it's meant to indicate what is in that string at the time. It's important. It can't parse the string, you've got to figure out what is in there that is throwing int::parse off and fix it. Me logging into your system is not going to change that, plus the policy of the forum is "keep it on the site."

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'd prefer not to do that, let's keep it on the site. On line 9 of the last time you posted code, put in System::Diagnostics::Debug::WriteLine("****** "+_selectedName+" *******"); Run your program, now in the bottom window of the IDE (marked output) tell me what's in between the stars.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

strcpy(dest,source) copies the source to the destination
EDIT: strcpy returns the destination string, you're treating it like it returns a concatenated one.

What you need is to strcpy Scards into Tcards and then use strcat to add Ncards to Tcards. Make sure Tcards is big enough to take on both strings.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So the number might be less than 100? You'll need to turn it back into a while loop.
Eliminate line 50, and substitute in while(inFile.getline( PetID[counter].status,6)) (eliminate line 53). infile.getline() will "drive" the loop and return a null value after the file is read). To keep track of the number of records, keep a counter (say, "recordno") and increment it at the end of the while loop. Then, run your for loop on line 64 to recordno instead of 100.