Forum: C Sep 18th, 2009 |
| Replies: 2 Views: 381 Standard C doesn't allow you to declare variables in the middle of statement blocks. |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 886 Post your code!
Did you initialise i ? |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 886 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 > basechars[r]
You're printing them, not storing them! |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 886 Store each char in another array, then print it out backwards? |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 886 Well it's good for bases < 10
char basechars[] = "0123456789";
and
printf("%c", basechars[r] ); |
Forum: C Sep 17th, 2009 |
| Replies: 20 Views: 886 > 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 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 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 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 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 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 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 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 Use %s to print a string of chars. |
Forum: C++ Sep 13th, 2009 |
| Replies: 7 Views: 499 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 > 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 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 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 |
Forum: C++ Sep 12th, 2009 |
| Replies: 5 Views: 439 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 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 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 You can't assign arrays.
Use strcpy() instead. |
Forum: C++ Sep 10th, 2009 |
| Replies: 5 Views: 351 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 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 > 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 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 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 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 Not enough?
How about looking at your needlessly complicated push_back()? |
Forum: C++ Sep 8th, 2009 |
| Replies: 9 Views: 672 > 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 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 Views: 232 Read the link (or your book). Your syntax is broken. |
Forum: C++ Sep 7th, 2009 |
| Replies: 9 Views: 377 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 > "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 > 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 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 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... |