Search Results

Showing results 1 to 40 of 1000
Search took 0.11 seconds.
Search: Posts Made By: Salem
Forum: C Sep 18th, 2009
Replies: 2
Views: 381
Posted By Salem
Standard C doesn't allow you to declare variables in the middle of statement blocks.
Forum: C Sep 17th, 2009
Replies: 20
Views: 886
Posted By Salem
Post your code!
Did you initialise i ?
Forum: C Sep 17th, 2009
Replies: 20
Views: 886
Posted By Salem
result[numchars++] = basechars[r];

When you're done, print from numchars-1 back down to 0 (one char at a time).
Forum: C Sep 17th, 2009
Replies: 20
Views: 886
Posted By Salem
> basechars[r]
You're printing them, not storing them!
Forum: C Sep 17th, 2009
Replies: 20
Views: 886
Posted By Salem
Store each char in another array, then print it out backwards?
Forum: C Sep 17th, 2009
Replies: 20
Views: 886
Posted By Salem
Well it's good for bases < 10

char basechars[] = "0123456789";

and
printf("%c", basechars[r] );
Forum: C Sep 17th, 2009
Replies: 20
Views: 886
Posted By Salem
> That is how I get the binary.
That's how you do it for every other base as well.
Forum: C++ Sep 16th, 2009
Replies: 4
Views: 390
Posted By Salem
pow (23, 2)
You're passing two integers.

> 'pow(int, int)' is ambiguous
two integers is confusing....

> double std::pow(double, int)
A variety of combinations involving floating point types...
Forum: C++ Sep 16th, 2009
Replies: 2
Views: 208
Posted By Salem
File permissions are platform specific, so you only get access to them using platform specific APIs.
Forum: C++ Sep 16th, 2009
Replies: 4
Views: 390
Posted By Salem
Taking a stab at guessing line 98

VoltageGain = double pow ((275 / sqrt (pow (23, 2) + 0.5 * pow (f, 2))), n);

What does double do here?
Forum: C++ Sep 16th, 2009
Replies: 8
Views: 427
Posted By Salem
pipes are a POSIX API (and not a language issue at all).

If you've got an appropriate declaration, then you can call them from whatever language you like (perl and python can access pipes as well).
Forum: C++ Sep 14th, 2009
Replies: 7
Views: 499
Posted By Salem
So do it in stages, say the spaces up to and including the first hash.

You don't have to write the whole thing just to make progress.
Forum: C Sep 14th, 2009
Replies: 5
Views: 790
Posted By Salem
How would I know.
You've now got two programs, and you've posted the code for neither of them.
Forum: C Sep 14th, 2009
Replies: 5
Views: 790
Posted By Salem
if(! CreateProcess("C:\\WINDOWS\\system32\\cmd.exe",
This needs to be something like
if(! CreateProcess("C:\\Users\\me\\Documents\\Projects\\Fib\\myfib.exe",

It does all the work.

This code...
Forum: C Sep 13th, 2009
Replies: 2
Views: 220
Posted By Salem
Use %s to print a string of chars.
Forum: C++ Sep 13th, 2009
Replies: 7
Views: 499
Posted By Salem
int nrP = 6;
for ( i = 1 ; i < nrP ; i++ ) {
cout << i << " " << (2 * nrP - 2 * i - 1) << endl;
}

Notice anything about the sequence of numbers?
Forum: C Sep 13th, 2009
Replies: 3
Views: 348
Posted By Salem
> if(fgets(temp, sizeof(temp), file) != NULL)
To read the whole file, do
while(fgets(temp, sizeof(temp), file) != NULL)

Oh, and remove the fclose() from inside the loop.

Or better yet, leave...
Forum: Java Sep 12th, 2009
Replies: 2
Views: 208
Posted By Salem
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/image/PixelGrabber.html
The manual seems clear enough.

32 bits of ARGB
Forum: C++ Sep 12th, 2009
Replies: 5
Views: 439
Posted By Salem
So use the debugger and put a breakpoint at the start of where you suspect the problem starts, and then wait for the first of the "first chance exceptions" to happen.

Then home in on the problem.
Forum: Motherboards, CPUs and RAM Sep 12th, 2009
Replies: 8
Views: 1,033
Posted By Salem
Forum: C++ Sep 12th, 2009
Replies: 5
Views: 439
Posted By Salem
Lessons in cause and effect.

Memory is allocated from one (or more) larger pools of memory.

int main ( ) {
int *p = new int[10];
for ( int i = 0 ; i <= 10 ; i++ ) p[i] = 0; //...
Forum: Motherboards, CPUs and RAM Sep 12th, 2009
Replies: 8
Views: 1,033
Posted By Salem
http://www.daniweb.com/forums/thread222501.html
OK, I've replied to both your questions now :icon_wink:
Forum: C++ Sep 11th, 2009
Replies: 5
Views: 351
Posted By Salem
Doubtful - it won't compile with TurboCrap, and it wasn't posted with code tags.
Does anybody bother to read intro threads?
Forum: C Sep 11th, 2009
Replies: 2
Views: 230
Posted By Salem
You can't assign arrays.
Use strcpy() instead.
Forum: C++ Sep 10th, 2009
Replies: 5
Views: 351
Posted By Salem
http://www.codeblocks.org/
http://www.microsoft.com/express/
Both are FREE (except for the time taken to download)
Both WIPE THE FLOOR with the fossil you have.
Both will serve you well when you...
Forum: C Sep 10th, 2009
Replies: 3
Views: 506
Posted By Salem
It would be better if you actually posted your actual error message.

Rather than saying "an error", hoping we can be
a) bothered to run your code
b) actually end up with the same error message...
Forum: C Sep 10th, 2009
Replies: 16
Views: 692
Posted By Salem
> Try this..Does it do your job:
Well it might, if you included stdlib.h as well.

Then you might be able to call malloc without having to resort to dangerous casting (it's REALLY dangerous...
Forum: C Sep 8th, 2009
Replies: 3
Views: 282
Posted By Salem
To further what Tom Gunn said, if you changed
char name[25]

to
char *name;


then the second printf would immediately be very wrong indeed, and not just ever so slightly odd.
Forum: C++ Sep 8th, 2009
Replies: 9
Views: 365
Posted By Salem
Lemme get this straight, you wrote some code but you don't have a really good idea of how it's "SUPPOSED" to work?

This is basically voodoo programming; write some mystic runes, sacrifice a goat,...
Forum: C++ Sep 8th, 2009
Replies: 8
Views: 589
Posted By Salem
Congratulations.

But using code tags would have been a good idea, if you wanted people to read it.
Forum: C++ Sep 8th, 2009
Replies: 9
Views: 365
Posted By Salem
Not enough?
How about looking at your needlessly complicated push_back()?
Forum: C++ Sep 8th, 2009
Replies: 9
Views: 365
Posted By Salem
Forum: C++ Sep 8th, 2009
Replies: 9
Views: 672
Posted By Salem
> asked and answered at least half a million times since Daniweb went live.
For the millionth time, stop exaggerating ;)


> Why yes, there is indeed a way.
Where there is a will, there is a...
Forum: C++ Sep 7th, 2009
Replies: 9
Views: 377
Posted By Salem
You read a line
You validate a line
If the line isn't what the user was asked to provide, then print an error message and read again.
Forum: C++ Sep 7th, 2009
Replies: 4
Solved: infinte loop
Views: 232
Posted By Salem
Read the link (or your book). Your syntax is broken.
Forum: C++ Sep 7th, 2009
Replies: 9
Views: 377
Posted By Salem
Is there a particular reason why you're doing this the hard way, with a "roll your own" per-character input?

Because there are standard library functions to read a whole line for you.
Forum: C Sep 7th, 2009
Replies: 9
Views: 416
Posted By Salem
> "program to swap two no. using third variable"
A better question would be:
"How to swap my idiot teacher of 1970's assembler tricks with someone who has a clue about programming in the modern...
Forum: C Sep 5th, 2009
Replies: 1
Views: 359
Posted By Salem
> I am trying to work learn thread programming in C.
Mmm-kay,

> I have my turbo C installed and its working fine.
You're stuck then.

> Please do shed some light on how to configure my Turbo C...
Forum: C++ Sep 5th, 2009
Replies: 5
Views: 441
Posted By Salem
Either set the length of the vector before you start, or use push_back() to add each new cube as you go.
Forum: C++ Sep 5th, 2009
Replies: 8
Views: 589
Posted By Salem
http://www.daniweb.com/forums/announcement8-2.html
Read this, make an effort, post that attempt and then ask a specific question.

Don't just dump your assignment on us and then go party, hoping...
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC