Search Results

Showing results 1 to 40 of 653
Search took 0.08 seconds.
Search: Posts Made By: Salem ; Forum: C++ and child forums
Forum: C++ Sep 16th, 2009
Replies: 4
Views: 378
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: 207
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: 378
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: 425
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: 497
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 13th, 2009
Replies: 7
Views: 497
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 12th, 2009
Replies: 5
Views: 434
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: C++ Sep 12th, 2009
Replies: 5
Views: 434
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: C++ Sep 11th, 2009
Replies: 5
Views: 349
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 10th, 2009
Replies: 5
Views: 349
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 8th, 2009
Replies: 9
Views: 363
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: 587
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: 363
Posted By Salem
Not enough?
How about looking at your needlessly complicated push_back()?
Forum: C++ Sep 8th, 2009
Replies: 9
Views: 363
Posted By Salem
Forum: C++ Sep 8th, 2009
Replies: 9
Views: 657
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: 375
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: 375
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 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: 587
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...
Forum: C++ Sep 1st, 2009
Replies: 2
Solved: runtime error
Views: 238
Posted By Salem
delete &capacidad;
delete &indice;
delete &datos;

All these are wrong.
a) you don't call delete AT ALL unless you called new.
b) a new [] is matched by a delete []
So
delete [ ] datos;
Forum: C++ Aug 30th, 2009
Replies: 3
Views: 219
Posted By Salem
All the files are in the same directory?

If so, all you need to do is add the two .cpp files to some kind of project (or makefile), and then build.

> cannot find -lfunctions.h".
-l is for...
Forum: C++ Aug 28th, 2009
Replies: 2
Solved: png to xpm
Views: 312
Posted By Salem
It lacks imagination, but did you try this?
http://www.google.se/search?q=png+to+xpm&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-GB:unofficial&client=firefox-a
Forum: C++ Aug 28th, 2009
Replies: 4
Views: 312
Posted By Salem
What - that you can't use a float to subscript an array?

The error message should have been pretty obvious.

Array subscripts are integers.
Forum: C++ Aug 24th, 2009
Replies: 10
Views: 452
Posted By Salem
Languages like C and C++ are far too flexible to diagnose ALL possible run-time faults at compile time.

If you post an exact run-time error message, we might be able to tell you where to start...
Forum: C++ Aug 24th, 2009
Replies: 10
Views: 452
Posted By Salem
Dunno, I can't see your code from here.
It would work if you did everything right, but since it doesn't, I'm guessing you need to fix something.
Forum: C++ Aug 24th, 2009
Replies: 3
Views: 234
Posted By Salem
You've got

#include "somethingElse.h"
#include "DoTestData.h"

The last thing in somethingElse.h is the real cause of the problem, and it will be missing the ; in question.
Forum: C++ Aug 23rd, 2009
Replies: 10
Views: 452
Posted By Salem
Or just be more careful writing out the existing data....
Forum: C++ Aug 23rd, 2009
Replies: 10
Views: 452
Posted By Salem
Your struct contains strings.

These are not simple objects, they contain pointers to where the data is stored (elsewhere). Simple write() functions don't know this.
...
Forum: C++ Aug 21st, 2009
Replies: 6
Views: 730
Posted By Salem
Better yet, tell US what you found out, how you solved it and then mark it closed.
Give something back.
Forum: C++ Aug 19th, 2009
Replies: 4
Views: 283
Posted By Salem
> file.write(tit,30);
If you're going to write 30 bytes, then you need
char tit[30] = "Title";

otherwise you're reading uninitialised memory and storing up who knows what kind of trouble.

>...
Forum: C++ Aug 18th, 2009
Replies: 16
Views: 1,046
Posted By Salem
> My requirement is that I add a very small value of the order 10^-7 with a relatively big value, say 36.63
floats have about 6 decimal digits of precision, doubles about 15.
10^-7 is more than 6...
Forum: C++ Aug 16th, 2009
Replies: 2
Views: 357
Posted By Salem
Correct indentation, and proper use of { } in all the places you need them would help.
Forum: C++ Aug 13th, 2009
Replies: 22
Views: 895
Posted By Salem
Debug assertions usually show up when you fail to do proper error checking.

Eg.

FILE *fp = fopen( "missing_file.txt", "r" );
// no check for success
int ch = fgetc( fp ); // debug assert here
Forum: C++ Aug 11th, 2009
Replies: 22
Views: 895
Posted By Salem
I've no idea then.

Did you start with an empty Win32 console project?
Forum: C++ Aug 11th, 2009
Replies: 8
Views: 323
Posted By Salem
Read the intro threads on how to use code tags.
Forum: C++ Aug 11th, 2009
Replies: 3
Views: 318
Posted By Salem
It's a pretty sure thing that you're looking at the effect rather than the cause.

Something else is probably trashing memory. Here is just where you first notice there is a problem.

In a...
Forum: C++ Aug 11th, 2009
Replies: 22
Views: 895
Posted By Salem
Sounds like the crappy PCH strikes again.
11218

Try turning PCH off.
It's only relevant if you're compiling vast projects which are pretty stable.
Forum: C++ Aug 11th, 2009
Replies: 22
Views: 895
Posted By Salem
> #include<iostream> using namespace std; Although its not good
Except it appears to be a C program from the logs.

But then again, who knows, the whole mess was posted without code tags to begin...
Forum: C++ Aug 10th, 2009
Replies: 12
Views: 1,778
Posted By Salem
http://msdn.microsoft.com/en-us/library/7dzey6h6(VS.71).aspx
Visual Studio 6 for example defaults to ANSI
Visual Studio 2008 defaults to UNICODE

The Win32 API functions (like CreateFile) are...
Showing results 1 to 40 of 653

 


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

©2003 - 2009 DaniWeb® LLC