Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Showing results 1 to 40 of 64
Search took 0.01 seconds.
Search: Posts Made By: spydoor
Forum: C Feb 10th, 2006, 3:07 PM
Replies: 18
Views: 388
Posted By spydoor
Just don't pay attention to my math :( Those 24s...

Just don't pay attention to my math :(
Those 24s should be 60s to get seconds

Time limit on edits?
Forum: C Feb 10th, 2006, 1:33 PM
Replies: 18
Views: 388
Posted By spydoor
As stated, you need to convert the times to...

As stated, you need to convert the times to seconds.
(Edit: Actually for your needs you only need to convert to minutes and not worry about seconds)
Find the difference
And then convert the time...
Forum: C Dec 19th, 2005, 4:16 PM
Replies: 9
Views: 352
Posted By spydoor
{ if(chem_ptr[i].atomic_num >...

{
if(chem_ptr[i].atomic_num > chem_ptr[HEnum].atomic_num)
HEnum = i;
}

how about weight?
Forum: C++ May 23rd, 2005, 8:27 AM
Replies: 2
Views: 151
Posted By spydoor
you are initializing the array incorrectly, it...

you are initializing the array incorrectly, it should be

for(int i=0; i<5; i++,c++) {
array[0][i] = c;
}

For the code you've shown you do not need a two dimensional array at all.


This should...
Forum: C May 18th, 2005, 7:48 AM
Replies: 5
Views: 241
Posted By spydoor
also remember that any macro used in your code is...

also remember that any macro used in your code is simply replaced with it's definition by the preprocessor (usually happens automatically right before compilation).

so anywhere in your code you...
Forum: C# May 16th, 2005, 12:12 PM
Replies: 15
Views: 507
Posted By spydoor
hmm, my experience is this is usually true. a...

hmm, my experience is this is usually true.

a variable declared within a block is only usable within that block.

I'm just curious.. what langauges don't behave this way?
Forum: C# May 13th, 2005, 9:00 AM
Replies: 26
Views: 809
Posted By spydoor
whoops, I was wrong. You do have to initalize...

whoops, I was wrong.

You do have to initalize variables when declaring that way.

when using new you do not have to.

default values using new...
Forum: C++ May 12th, 2005, 8:26 AM
Replies: 11
Views: 404
Posted By spydoor
you're printing too many b's because your...

you're printing too many b's because your algorithm for finding all the permutations is wrong. A quick search turned up a couple of solutions to the problem, iteratively and recursively. Your...
Forum: C++ May 11th, 2005, 3:11 PM
Replies: 11
Views: 404
Posted By spydoor
No, I don't know a specfic reason why, but it is...

No, I don't know a specfic reason why, but it is odd that you opened two streams to the same file, and one of them presumable for reading in input (fstream::in), which you never use.

This may be the...
Forum: C++ May 11th, 2005, 7:50 AM
Replies: 11
Views: 404
Posted By spydoor
char text = abc[b] && abc[c] && abc[d] && abc[e]...

char text = abc[b] && abc[c] && abc[d] && abc[e] && abc[f] && abc[g] && abc[h] && abc[i] && abc[j];
You're right this line is your problem, or at least part of it (I didn't notice anyting else wrong,...
Forum: C# May 10th, 2005, 3:29 PM
Replies: 26
Views: 809
Posted By spydoor
you can use ReadLine to get the entire line...

you can use ReadLine to get the entire line including the carriage return & form feed (which are then automatically discarded).

this returns a string, so like others have said you'll have to convert...
Forum: C May 10th, 2005, 2:46 PM
Replies: 16
Views: 479
Posted By spydoor
No, you cannot overload functions in C. I can...

No, you cannot overload functions in C.

I can see how there may be some confusion with many people using C++ compilers, which of course does allow overloading.
Forum: C May 10th, 2005, 2:09 PM
Replies: 19
Views: 398
Posted By spydoor
in both case getchar() and putchar() only deal...

in both case getchar() and putchar() only deal with one charcter

this code is misleading you

while ((x=getchar())!=EOF) {
if(x=='x') {
break;
}
putchar(x);
}
Forum: C May 9th, 2005, 4:00 PM
Replies: 16
Views: 532
Posted By spydoor
he uses size-1 because his implementation of...

he uses size-1 because his implementation of strlen() (array_size) returns the count including the ending null character, while the standard implementation does not.

size-2-x. would be...
Forum: C May 9th, 2005, 12:41 PM
Replies: 16
Views: 532
Posted By spydoor
then don't use strcmp, as I already said, rewrite...

then don't use strcmp, as I already said, rewrite it

you must create your own routine to compare the strings.

You cannot use == to compare char arrays


//this does not require a built-in string...
Forum: C May 9th, 2005, 12:35 PM
Replies: 16
Views: 532
Posted By spydoor
rewrite strcmp if you want... but you can't do...

rewrite strcmp if you want...

but you can't do this to compare the values of the strings, all this is doing is comparing the starting addresses
if(ch==arr2)

arrays are automatically passed by...
Forum: C May 9th, 2005, 12:29 PM
Replies: 16
Views: 532
Posted By spydoor
bugs with your original code. -you need to pass...

bugs with your original code.

-you need to pass the original array to StRev when you call it
-your c is actually one too many after the while loop
-you can't compare strings with ==, need...
Forum: Perl May 9th, 2005, 10:38 AM
Replies: 4
Views: 402
Posted By spydoor
The split is working exactly how you think it...

The split is working exactly how you think it is.

entry[0] is the word and
entry[1] is the definition

the problem is the assignment.

an example.

$dictionary{test} = 'test's definition' && print...
Forum: Perl May 9th, 2005, 8:32 AM
Replies: 4
Views: 402
Posted By spydoor
instead of using $dictionary{$_[0]} eq...

instead of using
$dictionary{$_[0]} eq undef
use
!defined($dictionary{$_[0]})
unfortunately I can't give you an explanation why.... I don't know :confused:



Looks like you have some other bugs..
Forum: C++ May 6th, 2005, 7:56 AM
Replies: 8
Views: 430
Posted By spydoor
use namespace std , or fully qualify #include...

use namespace std , or fully qualify

#include <iostream>
#include <iomanip>
using namespace std; // if you don't do this you have to fully qualify cout, fixed, setprecision .....

int main () {
...
Forum: Perl May 5th, 2005, 3:37 PM
Replies: 10
Views: 477
Posted By spydoor
the (.+): would not have eaten up the colon or...

the (.+): would not have eaten up the colon or anything after it unless there was a another colon later in the string. In this case it would match upto the final : in the string.

so you're right the...
Forum: C May 2nd, 2005, 11:16 AM
Replies: 9
Views: 329
Posted By spydoor
runtime errors.....impossible ;) like you said...

runtime errors.....impossible ;)

like you said it was about concept not syntax/stability, but mine did run for me

/junk/c$ a.out
1 3 2 4
6 3 1 0
1 2 6 1
2 2 1 5
Forum: C++ Apr 29th, 2005, 1:41 PM
Replies: 3
Views: 221
Posted By spydoor
The problem is how you are trying to call the...

The problem is how you are trying to call the functions.

(int n1, int n2) // do not need to define the types here
int multiply //int is the type of return value; you should assign the result of the...
Forum: C Apr 28th, 2005, 1:22 PM
Replies: 9
Views: 329
Posted By spydoor
This is based off what you started with, keeping...

This is based off what you started with, keeping some randomness. It works, but often generates a negative number for the bottom right corner, probably easy to fix...
Forum: Perl Apr 27th, 2005, 10:34 AM
Replies: 10
Views: 477
Posted By spydoor
Looks like a Perl answer may not help you at this...

Looks like a Perl answer may not help you at this point, but since it's in the Perl forum...

my $var = "(02:25:26) user: message";
$var =~ /\((\d+):(\d+):(\d+)\) (.+):(.*)/;

you put paranthesis...
Forum: C++ Apr 22nd, 2005, 2:53 PM
Replies: 12
Views: 288
Posted By spydoor
I saw it was a pointer, but what does it point...

I saw it was a pointer, but what does it point to?. It points to memory allocated for one char.

Yes, it compiles fine.
and Yes, it may even run fine, but that doesn't mean it's right.

Like I said...
Forum: C++ Apr 22nd, 2005, 2:20 PM
Replies: 12
Views: 288
Posted By spydoor
char *pointer = new char; immediately allocates...

char *pointer = new char;

immediately allocates space for ONE char , and it does not "grow" based on input.

The code you posted eariler is wrong. You'll likely get seg faults or other erratic...
Forum: C++ Apr 20th, 2005, 9:26 AM
Replies: 2
Views: 188
Posted By spydoor
your function prototypes do not match your...

your function prototypes do not match your function definitions

getdata prototype (char[], int , float, int)
getdata definition (int[], int, float, int)

similar for putdata, in the prototype your...
Forum: C++ Apr 20th, 2005, 7:48 AM
Replies: 4
Views: 220
Posted By spydoor
scanf requires the address of the variable you're...

scanf requires the address of the variable you're reading into

&start_atoms
&enter_atoms

Also, you should you srand() to seed the random number generator, or you'll always get the same output.

a...
Forum: Bash / Shell Scripting Apr 19th, 2005, 4:16 PM
Replies: 6
Views: 380
Posted By spydoor
Here's a nasty solution.... There must be much...

Here's a nasty solution.... There must be much better ways

count the number of files that match *.core... ignore 'No match'...
(to be correct you would also have to ignore other find error msgs...
Forum: Bash / Shell Scripting Apr 19th, 2005, 3:45 PM
Replies: 6
Views: 380
Posted By spydoor
Okay the -f does suppress the error message. The...

Okay the -f does suppress the error message.

The /home/<user>/*.core: no match is actually coming from your

(-e $HOME/*.core) statement
Forum: Bash / Shell Scripting Apr 19th, 2005, 3:33 PM
Replies: 6
Views: 380
Posted By spydoor
sorry, I was thinking ksh. I editied my post...

sorry, I was thinking ksh.

I editied my post what you want is, >&

also yes, It looks like with -f there should be no error msg to worry about.

Maybe I should've left this one to someone with more...
Forum: Bash / Shell Scripting Apr 19th, 2005, 3:07 PM
Replies: 6
Views: 380
Posted By spydoor
redirect STDERR apparently in csh there is no...

redirect STDERR

apparently in csh there is no standard way to do it, but there are ways..

http://www.codecomments.com/Unix_Programming/message452517.html
Forum: Perl Apr 15th, 2005, 8:04 AM
Replies: 5
Views: 484
Posted By spydoor
Yes, because 'world' is there twice, it loops...

Yes, because 'world' is there twice, it loops infinitely.
You need to understand what a hash (associative array) is, to really see what is going on.

For this example it's functioning like a lookup...
Forum: Perl Apr 14th, 2005, 1:40 PM
Replies: 5
Views: 484
Posted By spydoor
well I'll do my best...I'm no expert print while...

well I'll do my best...I'm no expert

print while $_=$_{$_}; # does nothing $_ is empty

$_='OTcommailDngATghiliaguans'; # initialize $_

1 while s/(.{5})(.{5})?/$_{$2}=$1,$2/e;

? match 0 or 1...
Forum: C++ Apr 13th, 2005, 9:14 AM
Replies: 15
Views: 521
Posted By spydoor
wierd.. you thought of the answer but don't know...

wierd.. you thought of the answer but don't know why.

cin >> name; // reads up to whitespace, newline , or EOF

so you were never reading in a space to begin with.

cin.getline(name, length); //...
Forum: C++ Apr 5th, 2005, 11:20 AM
Replies: 8
Views: 430
Posted By spydoor
cout << fixed << setprecision(2) <<...

cout << fixed << setprecision(2) << value;
Forum: C++ Mar 29th, 2005, 10:16 AM
Replies: 9
Views: 221
Posted By spydoor
is it possibly somewhere else in your code. This...

is it possibly somewhere else in your code.
This simple example worked for me on 2 different compilers

#include <stdio.h>

int main()
{

FILE *ME;
char s[1000];
Forum: C++ Mar 29th, 2005, 8:26 AM
Replies: 16
Views: 760
Posted By spydoor
search for FindFirstFile and FindNextFile for...

search for FindFirstFile and FindNextFile for windows api implementations
Forum: C++ Mar 29th, 2005, 8:14 AM
Replies: 9
Views: 221
Posted By spydoor
you declared each FILE as a pointer, so your...

you declared each FILE as a pointer, so your array should be of type FILE *

FILE *displayarray[numberofdisplays];
Showing results 1 to 40 of 64

 
Forum Jump



DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:35 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC