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

read the Read Me threads at the top of this board because they have lots of information and suggestions.

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

Sorry to wake you up Ancient! Physiologically you only have a limited number of neurons in your brain, so I don't think it will ever have infinite capacity!

I think you need to study more. According to this the bran has infinite capacity to produce new neurons. I'm in no way any expert in human biology (I flunked it in HS :) ) I also saw a documentary film on the History channel (I think) the other day about doctors surgecally separating twins who were joined at the head and shared a common brain. Over several surgeries in several months they gradually cut the brain in half. After each surgery each half was able to generate new neurons to replace those that had been lost to the division. Eventually they were able to completly sever the brain in two and also cut the crainium as well. Although they had to relearn how to do everything that children normally learn as an infant the two children are today leading near normal lives.

there is a limit to the total knowledge we as a race can acquire. (For example, we take a child from birth and teach him/her mathematics until death. He must learn basics first:algebra,geometry,calculus 1&2,differential equations,linear algebra,etc. Eventually we will acquire enough knowledge to keep a student in class from birth until death.. which leaves little room for the discovery of anymore concepts)

Ridiculous! That is hardly proof that there is an upper limit to the amount …

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

LOL That's crazy stuff :)

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

What happens to all of the posts with inlinecode tags?

Nothing -- you can still use inlinecode if you want to.

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

I'm using IE7 on Vista and they work ok.

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

>>and i think it will work for this program because the number will never be larger than 10...

You are missing the point!! Since its supposed to return a double than make the dam thing a double and not a float.

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

This is great news. Millions of hugs and kisses :)

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

so your rant in post #3 was pointless, seeing as my question has been answered and I'm working on fixing my program already... thanks tho! :)

Not it was not pointless -- it applies to anyone who starts new threads ASSUMING that everyone knows that you are talking about. If you're going to start a new thread then at least give everyone the courtesy of making it a complet thread that does not require us to read some previous thread. Most people will just ignore you when you do not do that.

But, I'm glad for you that you're on you way to solving the problem :)

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

The key to your problem was described by Duoas so I won't repeat it.

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

A float does not have the precision of a double so if you give that function a large enough number typecasting the float to a double will fail. Again, if the function is supposed to return a double then return a double not a float. Your compiler does not complain because there promoting a float to a double is not a problem -- its the other way around that's the problem.

If float is really what you want then make the function's return type a float and not a double. It's a matter of consistency. Just because it compiles cleanly and works (for now) doesn't make it right.

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

OMG Dani you fixed the smilies :) Thank you.

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

[EDIT]
man, too slow again...

fooey.

Happes to all of us all the time :D

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

1. getScore() is supposed to return a double, but is actually returning a float. If you want it to return a double then declare avg as a double.

2. The calculation is doing integer arithmetic because 3 is an integer. If you want it to do floating point then it needs to be 3.0. Since we don't know what those functions from class Stat return you should probably typecast the whole thing to a double.

avg = (double)(s.getSum() - s.getMax() - s.getMin()) / 3.0);

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

>>same problem
Same problem as what?? I have no idea what you problem is. When starting a new thread do not make it dependent on a previous thread. If there is a problem then you need to describe what the problem is. To keep from repeating yourself you should not have started a new thread but just posted to the original thread so that everyone knows what the hell you are talking about.

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

add a float counter and then add the value of counter to it within the loop that begins on line 7 of the code you posted.

>> but my code is all over the board.
Looks ok to me, just add the code I mentioned above and you have the answer.

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

>>Is it okay to put this thread in the C++ forum, right
No, I'm moving it to the lounge because it isn't a c++ program question.

As for your main question -- sorry but I don't have any experience with CLI, so I can't answer them. I know there's a lot of free code and a couple tutorials over at www.codeproject.com.

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

think I'm gonna have a nervous breakdown during the presentation. Argh! I'm really not at all good at talking and especially in front of people. >_> doesn't make much sense huh! But I get nervous like hell, and stammer and then forget what I should say, and end up repeating the same thing, which is really annoying >_<!

Take speech 101 course. Use 3x5 cards and write down major topics for discussion then use those cards during your presentation. Almost everyone gets nervous, its called Stage Fright and even the most accomplished people catch it.

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

Networking: google sockets. There are hundreds of example programs on the net. One of them here (it has lots of other stuff too that might interest you)

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

Exactly what version of the compiler are you using? VC++ 2005 Express ? If yes, then you need to download (free) the Windows Software Development Kit (SDK). See these google links for your operating system

And yes, the function you want is Sleep(). And BTW you might as well start right now getting accustomed to searching MSDN because you will need it alot.

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

If it were true that we have a limited amount of memory then at some point we would have to stop learning. One could say "I have learned everything possible to learn, so I can go have a beer now.". I doubt that point in or evolution will ever happen, consequently we have infinite capacity to learn.

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

Actually the urban legend that we only use 10% of our brains is false. I read somewhere that we actually utilize the majority of its potential.
.

Not possible to use the majority of its potential because it has infinite potential so what's the majority of infinity?

To say "we use all of our brain all of the time" says nothing about the potential of human intelligence, creativity, and problem solving. Such a skeptical rebuttal of the vast potential of the human think machine implies that we have reached our limits of brain potential- probably the most harmful dead end notion of all. We haven't even gotten close.

Our frontal lobes have been culturally and socially lobotomized. At this stage of evolution, we are simply still Apes With Pencils.

thunderstorm98 commented: Nice Post +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

link is bad -- on Vista Home Premium I get unknown extension error (*.pl)

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

Thanks Ancient! The reference to a shorter memory was exactly that, the more folks are asked/bombarded to remember the less they seem to remember.

Actually that was not what I was talking about. Your memory naturally gets sorter as you age. Been there, done that :) But to answer your question, I doubt the increasing amount of information is causing any ill affects on the brain. Afterall we use very little of its power anyway.

Can those new high capacity solid state flash drives in competition with mechanical hard-drives? I read that HP is producing a new notebook with a 32G flash drive instead of a HD.

Sorry but I don't know a thing about it (or mayb I just forgot)

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

>>Those were the good old times!
I disagree because those "good old times" had more disease than we have today, AIDS was 100% fatal, less fuel-efficient automobiles, so-called educational films taught children to hide under their desks in case of nuclear attack, and many many more disadvantages.

"Good old days" ??? There has never been a better time for most people than today (politics excepted)

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

>>Is it also getting shorter?
Yes -- the older you get the sorter your memory :)

>>Are hard-drives doomed?
Probably, but not in the near future. They need to replace with something for long-time storage.

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

wait in a socket, write a client which pumps data faster than your server can process.

I don't think that is possible because I THINK the socket libraries will slow everything down to prevent that from happening.

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

>>Actually it works
Yes it will work if you do not define UNICODE because TCHAR is defined as char and sizeof(char) is always 1. So your code reduces to srf_ReadFile.GetLength()/1, or just simply srf_ReadFile.GetLength(). Now define UNICODE and your formula will change to srf_ReadFile.GetLength()/2, which will result in 1/2 of the actual file size if you are on MS-Windows or 1/4th the file size on *nix because sizeof(TCHAR) = 2 (a short int) on MS-Windows and sizeof(TCHAR) is 4 on *nix (a long int)

>>Few reasons I have to use it. First thing is I want to design GUI
Not a reason to use CFile. Just because you have an MFC program is not a reason to use CFile either. You can mix CFile with fstreams in the same program -- I have done it hundreds of times.

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

I think its pretty funny. :) :) Some people just like to be silly and laughed at. You all are too prudish.

Of course, on the flip side of that coin it means he will never be taken seriously on any of the sofware development boards.

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

>>void convert (char filename[]); /* function is defined as char *filename not char filename[], even if it works like that */

they are both the same so it doesn't matter. But they should be consistent not because the compiler will care but because good programming style.

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

even the fstream example you posted is not workable.

line 4 does not calculate the size of a file but the number of TCHARs in the file, which might or might not be the same as the size depending on the UNICODE setting.

As for CFile, the answer is NO -- and that's one reason why I hate that class. Unless the file contains serialized MFC objects you are better off using normal c++ fstreams, assuming your compiler supports it (some do not).

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

>> Reputation-Altering Power
What is that? both you and I (and probably everybody else too) its value is 0.

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

Instead of making 8 copies of that huge array I'd make just two, say array A and B. pass array A to a sort method, after sorted copy B to A and pass A to the second method. Do this for each sort algorithm. It'll save a whole lot of memory.

How to copy arrays depends on the kind of array you want. If c++ vector then its a simple assignment.

vector<int> A;
vector<int> B;
B = A;

if its a C-style array

int A[1000000];
int B[1000000];
memcpy(B, A, sizeof(A));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I suppose that something is either Sleep() (MS-Windows) or sleep() (*nix) which will cause your program to get very little CPU time.

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

It doesn't work because line 4 doesn't do anything. This function will convert the entire sentence to all upper-case. Hope that's what you want to do.

void printSentence(char *sentPtr){
    char *sent = sentPtr;
    while(*sent)
    {
        if(islower(*sent))
	        *sent = toupper(*sent);
        sent++;
    }
    *sent++ = '.';
    *sent = 0;
    cout << sentPtr << endl;
}

[edit] I compiled and ran your original program with the changes I made above and it compiled and ran without error. I did not see the problem you reported.[/edit]

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

you need to use the && operator, not ||

while (choice != 'Q' && choice != 'q');
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>have revised, It still doesnt work exactly though
You need to pass your convert() function the filename because its declared in main() and not visible to convert().

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

>>toupper(filename);
Nope. toupper() only accepts a singlle character. There are no standard functions that converts the entire string, so you have to write that part youself. Put the below in a loop and you will have it. filename[0] = toupper(filename[0]); >>gets(filename);
Never ever use gets(). use fgets() instead like this: fgets(filename,CHARSIZE,stdin);

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

>>Where do c++ developers obtain their libraries
learn to use google. It would seem to me that you may have to write a device driver or program that hooks into the keyboard device driver because normally keyboard input is normally routed to the foreground window.

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

First, the program you posted is a bastardization of C and C++ languages. As for your problem you need to flush the '\n' (Enter key) from the keyboard buffer after the sscanf(). There are several ways to do that but in C the easiest is to call getc() to remove the '\n'.

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

>>What do you mean?
If you don't know by now you will probably never know :) Which is why I would never ever refer to a cat in mixed company using that word. I got in a lot of trouble while stationed at RAF Miltenhall during the 1970s. I was in a pub talking to a friend. He was backed up to a fireplace warming his butt when I said "Warming your fanny huh?". His face turned all colors of red and he told me what it meant in UK.

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

Not possible to do it in pure C or c++ because the languages do not support cursor movement. You could do it in MS-DOS pretty easily with TurboC++ compiler. All modern MS-Windows compilers will require win32 api console functions. For *nix I suppose you might have to use curses library functions.

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

A more important question is: why is that find method returning void? A find method normally locates an instance of something and returns the result to the calling function. If it didn't there would be no point to the function as it appears to be with your function.

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

>>i have no idea where to start
Start here:

int main()
{
    // your code goes here
}

You might research some of these google links

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

did you correct printSentence() that I mentioned?

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

lines 85 thru 88: use a while loop

while( *dest++ = *src++ )
   ;

function printSentence at line 98: you have to save pointer sent before executing lines 100 thru 102, then use the saved pointer in line 103 because as written that function is destroying the value of the pointer.

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

>>It only prints the first character of the question string
>>printf("%c", mc);printf("%c", mc);

Well duuuh. That's exactuly what you told it to print. The "%c" says to print only a single character. if you want an entire null-terminated string then use "%s" and pass a pointer to the string you want printed.

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

How about my original suggestion?

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

This has got to be among the world's best every written songs! Hope people will enjoy it for hundreds of years to come. :)

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

You should no longer be seeing the horizontal scroll with signatures enabled.

Great! now I'll put mine back.

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

Ok, lets just cut right to the chase. Beat this one if you can (Graham's number)