Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
3
Posts with Upvotes
3
Upvoting Members
3
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Commented Post
~9K People Reached
Favorite Tags

19 Posted Topics

Member Avatar for SVR

I'm trying to simulate particle attraction and motion. Given two particles with 0 velocity at distance X, the acceleration due to attraction is such that the sum of acceleration must be equal to the sum of the deceleration over the same time after the particles pass causing the velocity to …

Member Avatar for SVR
0
146
Member Avatar for SVR

I have a parser that builds a list of variables and a list of expressions. I put those into a block expression and compile ... [CODE] var blk = Expression.Convert(Expression.Block(Parser.m_Vars, Parser.m_Expr),typeof(CVar)); var expr = Expression.Lambda<Func<CVar>>(blk); var result = ""; try { var actionX = expr.Compile(); result = actionX(); } [/CODE] …

Member Avatar for SVR
0
174
Member Avatar for guguman

What it is telling you is it can't find a matching function to construct the base class 'account'. If there is not one, change your checkingAccount constructor to call the correct account constructor... [CODE] checkingAccount::checkingAccount(string inType) :account(inType) { }; [/CODE]

Member Avatar for SVR
0
140
Member Avatar for gandolf III

Insert at line 123 ... [CODE] else { printf("\nduplicate or unknown character\n"); } [/CODE] and see what you get.

Member Avatar for dkalita
0
111
Member Avatar for OSiRiSsk

Just a few things to clear up. 1) How are existing new lines to be handled? If they should be ignored then line 35 should not output if c == EOL. 2) In the skip space loop you will skip new lines (isspace('\n') == true). So your test to restart …

Member Avatar for automart
0
150
Member Avatar for timaquerra

Save the result of the string compare so you wont do it twice. Then just increment a counter. [CODE] int seq_Search(char array[][MAXSIZE], int end, char *key) { int mid; int first = 0; int last = end; int cmp; while(first <= last){ mid = (first + last) / 2; cmp …

Member Avatar for timaquerra
0
122
Member Avatar for Whilliam

It works for both cases here. I didn't see any glaring problems that relate to your issue. At line 97 I think you intended something else ... [CODE] for(ctr = 0; ctr < strlen(n); ctr++) sum += (int)n[ctr]; // [ctr]<--- you want to sum the chars ? [/CODE] I'll look …

Member Avatar for Whilliam
0
403
Member Avatar for raigs

Just cast the return, time_t is equivalent to int for 32 bit OS. [CODE] return (int) MTIME; [/CODE] To fix the printf warning include stdio.h

Member Avatar for SVR
0
80
Member Avatar for its.avinash

Well it looks like that's what it's supposed to do. It should print the hex representation of the floating point number 4.379. But I don't see how it will compile and it will only print 3 of the 4 hex bytes.

Member Avatar for Gaiety
0
137
Member Avatar for Hiroshe

[QUOTE=Hiroshe;903618]Still room for inprovement, but I got it working a reasonalble speed.. I think I kinda solved this thread on my own, but if there are any other suggestion's, I'm still interested in making my code faster.[/QUOTE] The first improvement I found was that you don't need to regenerate all …

Member Avatar for SVR
0
184
Member Avatar for OSiRiSsk

The code as is should work right the first time. If you are reading multiple lines it will start putting leading spaces in because start is not reset for the next one.

Member Avatar for OSiRiSsk
0
542
Member Avatar for ashok.g15

In the case of zero sized array, it was generally used as an easy way to index into a variable sized buffer ... [CODE] struct Header { DWORD dwMagic; DWORD dwSize; BYTE data[]; }; void MyFunction() { Header *pHdr = (Header *)buffer; Read(buffer, MAX_SIZE); switch(pHdr->dwMagic) { case M_TAG('R','I','F','F') : HandleRIFF(pHdr->data,pHdr->dwSize); …

Member Avatar for Tom Gunn
1
951
Member Avatar for macdonald12

If speed is not critical use a recursive function. [CODE] GenNextMove(int depth) { if(depth == nMaxMove) { nTotalPos++; return; } for(i = 0;i<nMoves;i++) { GenNextMove(depth+1); } } main(...) { GenNextMove(0); } [/CODE] You can pass the current position as well to store in a final positions array when MaxMoves is …

Member Avatar for SVR
0
187
Member Avatar for Triztian

[QUOTE=vmanes;1013734] Typical loop usage: [code] int arr[10][5]; int r, c; for( r = 0; i < 10; r++ ) for( c = 0; c < 6; c++ ) // <--- typo ? //do something with arr[r][c] [/code] [/QUOTE] I'm assuming that was a typo? @Triztian: Array elements follow each other …

Member Avatar for vmanes
0
115
Member Avatar for Marton

Also it would be a good idea to save strlen(string) and instead of doing strlen in the for loop. [CODE] int iLen = strlen(string); for(i = 0; i < iLen; i++) ... [/CODE] Not only to save operations, but in the non- tempString version you could actually get the wrong …

Member Avatar for dkalita
0
139
Member Avatar for Grn Xtrm

You can do this without the 'if' checks and with 2 nested for loops. Break your problem up to it's smallest pieces and choose a path that solves the pieces with the least redundancy. Smallest piece - put '*' in array at correct place... [CODE] "--*--" ar[0][cnt/2] = '*' [/CODE] …

Member Avatar for Dave Sinkula
0
4K
Member Avatar for jrkeller27

The stringSend member should not be part of the structure you send. It is just a 4 byte ptr that will be meaningless to the receiver. Thus when you send it will be sizeof(struct) - sizeof(char *) bytes. Then you send the payloadLength bytes at stringSend; When you receive do …

Member Avatar for gerard4143
0
828
Member Avatar for SVR

Im calling a function in a 3rd party dll. Somewhere down the line it hits an access violation (0xC0000005). I wrapped the call in a try/catch but it never catches and the runtime pops up the old Unhandled Exception. This call is several calls deep in my code so I …

Member Avatar for SVR
0
203
Member Avatar for SVR

Hi, I wonder if anyone has seen a solution for a similar problem or can think of a better solution than this. I initially tried to use Floyd-Warshall with a MAX function instead of MIN but the result was not as expected. If one could make that work it would …

0
90

The End.