Search Results

Showing results 1 to 33 of 33
Search took 0.01 seconds.
Search: Posts Made By: SVR
Forum: C++ 6 Days Ago
Replies: 9
Views: 154
Posted By SVR
I don't think it is doing what you think it is.


account newAccount(inType1);
newAccount.makeDeposit(ammount);
...
Forum: C++ 7 Days Ago
Replies: 9
Views: 154
Posted By SVR
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...
Forum: C 9 Days Ago
Replies: 2
Views: 189
Posted By SVR
Save the result of the string compare so you wont do it twice. Then just increment a counter.



int seq_Search(char array[][MAXSIZE], int end, char *key)

{
int mid;
int first = 0;
int...
Forum: C 10 Days Ago
Replies: 2
Views: 222
Posted By SVR
Insert at line 123 ...


else
{
printf("\nduplicate or unknown character\n");
}


and see what you get.
Forum: C 10 Days Ago
Replies: 1
Views: 135
Posted By SVR
Just cast the return, time_t is equivalent to int for 32 bit OS.


return (int) MTIME;


To fix the printf warning include stdio.h
Forum: C 10 Days Ago
Replies: 3
Views: 163
Posted By SVR
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 ...


for(ctr = 0; ctr < strlen(n); ctr++)
sum +=...
Forum: C 11 Days Ago
Replies: 10
Views: 665
Posted By SVR
You should be able to see how by now.
What controls space output? The variable spaceNeeded. If true it will output a space before the next character.

Now where should it be set to true?


...
Forum: C 16 Days Ago
Replies: 3
Views: 197
Posted By SVR
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...
Forum: C 17 Days Ago
Replies: 10
Views: 665
Posted By SVR
This code is the same as you had. Just re-arranged a little.
I moved the sentence check first to catch the next non dot. The way it was (after the space skip) made it impossible to tell between the...
Forum: C 18 Days Ago
Replies: 6
Views: 444
Posted By SVR
The first improvement I found was that you don't need to regenerate all the primes every time. Split the array into separate arrays. One global array of primes and one for factor counts.

This...
Forum: C 19 Days Ago
Replies: 10
Views: 665
Posted By SVR
Sorry for the double post, could not edit for some reason...

Another look, in order to catch the next non dot correctly you have to check before the skip space loop.


#define FALSE 0
#define...
Forum: C 19 Days Ago
Replies: 10
Views: 665
Posted By SVR
The last condition should not check for new line any more. You want to restart skipping after the last sentence now (when the count is reached as I said). In other words when you do putchar('\n');
...
Forum: C 20 Days Ago
Replies: 10
Views: 665
Posted By SVR
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...
Forum: C 26 Days Ago
Replies: 14
Views: 405
Posted By SVR
Agreed. Saying it will crash is highly subjective.

I will try to avoid that in the future. I forget that what's 'obvious' to me is not to every one :)
Forum: C 26 Days Ago
Replies: 14
Views: 405
Posted By SVR
It's purely theoretical. You shouldn't have to compile it to see that it will crash.

The buffer will be filled with unknown data after the first two known values so the four bytes at BYTE *data...
Forum: C 26 Days Ago
Replies: 5
Views: 282
Posted By SVR
That is a typical search problem. The given solution is a 'depth first' search where you search down the chain of moves before considering other moves. Potentially more efficient is a 'breadth first'...
Forum: C 26 Days Ago
Replies: 14
Views: 405
Posted By SVR
Let's try it with my previous example.


struct Header {
DWORD dwMagic;
DWORD dwSize;
BYTE *data;
};

void MyFunction()
Forum: C++ 26 Days Ago
Replies: 5
Views: 206
Posted By SVR
I'm assuming that was a typo?

@Triztian:

Array elements follow each other contiguously in memory.

int arr[2][5] will look like this in memory

0,0 | 0,1 | 0,2 | 0,3 | 0,4 | 1,0 | 1,1 | 1,2...
Forum: C 27 Days Ago
Replies: 14
Views: 405
Posted By SVR
In the case of zero sized array, it was generally used as an easy way to index into a variable sized buffer ...


struct Header {
DWORD dwMagic;
DWORD dwSize;
BYTE data[];
};
...
Forum: C 27 Days Ago
Replies: 28
Views: 1,472
Posted By SVR
Glad it is working. One thing to check though ...
isspace(c) will be true for EOL so you will skip some line endings.
Sorry about the example not building. I've been doing c++ too long.
To...
Forum: C 28 Days Ago
Replies: 28
Views: 1,472
Posted By SVR
That will leave leading spaces as well.
Besides the fact it is way more complicated than needed.
Forum: C 28 Days Ago
Replies: 28
Views: 1,472
Posted By SVR
Make it so it's just like the first time so reset both of em ...


#define EOL '\n'

...

if(c == EOL)
{
putchar(c);
Forum: C 28 Days Ago
Replies: 28
Views: 1,472
Posted By SVR
Close but not quite right Aia.

This will leave a leading space and a trailing space before the line feed.

You can fix yours OSiRiSsk. Just check for the EOL and reset the flags.
Forum: C 31 Days Ago
Replies: 8
Views: 498
Posted By SVR
Just change your printf("%c" to printf("|%c" and printf("\n" to printf("|\n"

You should probably split the code into sections though, like: ClearArray, FillArray, and ShowArray. Then you can make...
Forum: C 31 Days Ago
Replies: 7
Views: 345
Posted By SVR
Also it would be a good idea to save strlen(string) and instead of doing strlen in the for loop.


int iLen = strlen(string);

for(i = 0; i < iLen; i++)
...
Forum: C 31 Days Ago
Replies: 28
Views: 1,472
Posted By SVR
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.
Forum: C 31 Days Ago
Replies: 2
Views: 325
Posted By SVR
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 *)...
Forum: C 31 Days Ago
Replies: 8
Views: 498
Posted By SVR
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...
Forum: C 32 Days Ago
Replies: 5
Views: 282
Posted By SVR
You'll want to keep your x & y local so each move is incremented from the correct position (you'll need to pass these in as params with the starting position sent in the first call). As it is the...
Forum: C 32 Days Ago
Replies: 5
Views: 282
Posted By SVR
If speed is not critical use a recursive function.


GenNextMove(int depth)
{
if(depth == nMaxMove)
{
nTotalPos++;
return;
}
Forum: C++ Sep 9th, 2008
Replies: 2
Views: 759
Posted By SVR
Thank you.

It turns out (after trying the various different exception handling techniques) that the exception was being thrown from another part of the code.

The dll calls the suspect function...
Forum: C++ Sep 9th, 2008
Replies: 2
Views: 759
Posted By 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...
Forum: Computer Science May 17th, 2008
Replies: 0
Views: 692
Posted By 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...
Showing results 1 to 33 of 33

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC