Forum: C++ Apr 1st, 2009 |
| Replies: 19 Views: 1,562 I doubt that anyone here will take up the task of modifying the program.
A slight chance of getting some sort of assistance might be to contact the author, his contact information is available on... |
Forum: C Mar 31st, 2009 |
| Replies: 4 Views: 325 Maybe Beej's Guide to Network Programming (http://beej.us/guide/bgnet/output/html/multipage/index.html) |
Forum: C Mar 31st, 2009 |
| Replies: 10 Views: 640 There is an initialization failure ...
for( i = 0; i < n; i++ ) numberlist[i] == rand() % n ; |
Forum: C++ Mar 31st, 2009 |
| Replies: 3 Views: 407 I think the two friend declarations need template <class T>
template <class T>
class Tree
{
...
template <class T> friend void buildExprTree(Tree<T> & expr);
template <class T> friend int... |
Forum: C++ Mar 30th, 2009 |
| Replies: 3 Views: 2,257 Yes, those *'s have been there for quite some time ...;) |
Forum: C++ Mar 30th, 2009 |
| Replies: 7 Views: 360 PointFriend must be a friend of Point because PointFriend's constructor accesses a private member of Point (i.e. P.x).
Whether or not "friend class Point;" is declared in the above example makes... |
Forum: C++ Mar 30th, 2009 |
| Replies: 3 Views: 437 Looking at your previous post, there's an orphan if there ...
break;
case '#':
if
break;
default: |
Forum: C++ Mar 30th, 2009 |
| Replies: 13 Views: 629 Yes, you are missing semicolons ...
void bird :: double travel_time (double distance, terrain_type t)
{
switch (t)
{
case PLAIN: travel_time = ((distance/landspeed)*1) ;... |
Forum: C++ Mar 28th, 2009 |
| Replies: 8 Views: 736 // in this case, there are 20 bytes available for use at ptr[0 .. 4],
// one use might be by means of strcpy()
strcpy(ptr[0], "Hello ");
strcpy(ptr[1], "wond");
// cleanup ...
for(int i = 0;... |
Forum: C++ Mar 28th, 2009 |
| Replies: 11 Views: 536 You can use const_cast, i.e.
Node * temp = const_cast<Node*>(this);
Maybe you could revise the 'constness' of the code (I did not look too closely). Perhaps read about Const correctness... |
Forum: C++ Mar 28th, 2009 |
| Replies: 8 Views: 736 That is not quite correct, see comments
int main(void)
{
/* Declare the '2D Array' */
char ** ptr = new char * [5];
ptr[0] = new char[20];
ptr[1] = new char[20];
ptr[2] =... |
Forum: C++ Mar 28th, 2009 |
| Replies: 24 Views: 1,318 Yes. A suggestion, maybe first exercise with a smaller problem, e.g. try to simulate the "(0 <= n <= 1) to move row n right 1 position".
You might have ...
const int COLS = 3;
int array[COLS] =... |
Forum: C++ Mar 28th, 2009 |
| Replies: 24 Views: 1,318 Hmm, but looking closely at initPuzzle(), it clearly achieves the scrambling by calling movePuzzle(...) on two occasions.
// scramble the puzzle
for (y=0; y<=ROWS*COLS; y++) {
if... |
Forum: C++ Mar 28th, 2009 |
| Replies: 24 Views: 1,318 As per the code you are given in puzzle.h, the scrambling of the puzzle is actually done by means of the movePuzzle(), hence I asked about its code. If you haven't coded it yet, your output will be... |
Forum: C++ Mar 28th, 2009 |
| Replies: 24 Views: 1,318 What code you have in movePuzzle(...)? |
Forum: C++ Mar 27th, 2009 |
| Replies: 24 Views: 1,318 Oh I see, let the professor have his/her ways then. But in the future, you know to avoid atoi(). |
Forum: C++ Mar 27th, 2009 |
| Replies: 24 Views: 1,318 About converting the seed, you'd be better of using stringstream (atoi() is a poor choice for that). Below is a snippet for the
conversion ...
#include <sstream>
#include <iostream>
using... |
Forum: C++ Mar 27th, 2009 |
| Replies: 3 Views: 709 Think of bar->second as a map <string, int>, so simply ...
bar->second["abc"] = 123; |
Forum: C++ Mar 27th, 2009 |
| Replies: 12 Views: 393 Maybe you could post the "includes.h" file? |
Forum: C Mar 24th, 2009 |
| Replies: 13 Views: 1,922 Maybe print the error message (see grapherrormsg(...)) to a file to get a clue about what's wrong. |
Forum: C++ Mar 24th, 2009 |
| Replies: 10 Views: 404 Problem is that x is not initialized to zero (I take that you simply want to swap the values).
You might have it a bit simpler like ...
if (numB < numA)
{
// use x only inside the... |
Forum: C++ Mar 24th, 2009 |
| Replies: 4 Views: 392 When you tried that and noticed that problem, are you sure that you did not have the d.clear(); call. Because the clear(), as you now have it, will empty the vector (of the tmp Demo object) so you'll... |
Forum: C++ Mar 24th, 2009 |
| Replies: 4 Views: 392 Pass the vector by reference just like you already pass the Demo object.
istream& operator>> (std::istream& in, vector<double> & d);
std::istream& operator>> (std::istream& in, vector<double> &... |
Forum: C++ Mar 23rd, 2009 |
| Replies: 7 Views: 343 Some comments ...
//Adding the two numbers together
int Add(int num1, int num2)
{
int addedTotal;
// sum up the values ...
addedTotal = num1 + num2;
// display text ...
cout << "The two... |
Forum: C++ Mar 23rd, 2009 |
| Replies: 7 Views: 343 As long as you have an internet connection, you can always check online, whether or not your code compiles. Below are couple links:
Comeau (http://www.comeaucomputing.com/tryitout/)
and ... |
Forum: C++ Mar 22nd, 2009 |
| Replies: 3 Views: 1,451 If you represent the values as integers (e.g. 0 .. 100), then it will work. So a working .ini file might look like ..
[section]
; with % -sign
value1=15%
; without % -sign
value2=99 |
Forum: C++ Mar 21st, 2009 |
| Replies: 38 Views: 2,973 Maybe your codeblocks is old enough to not to have the following definitions
#ifndef SHTDN_REASON_MAJOR_OTHER
#define SHTDN_REASON_MAJOR_OTHER 0x00000000
#define... |
Forum: C++ Mar 21st, 2009 |
| Replies: 38 Views: 2,973 Did you get the UAC prompt when you ran the shutdown.exe command? If you did, then you'll need a manifest like jbennet showed.
I think it is rather a Policy Configuration issue, i.e. "Shut... |
Forum: C++ Mar 21st, 2009 |
| Replies: 38 Views: 2,973 Maybe you could try out the following program, and post back its output. It might give some clue about what is not working.
#include <windows.h>
#include <stdio.h>
BOOL SetPrivilege
(
... |
Forum: C++ Mar 21st, 2009 |
| Replies: 3 Views: 1,451 See GetPrivateProfileInt Function (http://msdn.microsoft.com/en-us/library/ms724345(VS.85).aspx) |
Forum: C++ Mar 20th, 2009 |
| Replies: 38 Views: 2,973 Nothing in the MSDN documentation on ExitWindowsEx() indicates that. How did you came into that conclusion? |
Forum: C++ Mar 20th, 2009 |
| Replies: 38 Views: 2,973 There might be many reasons, e.g. any application you have open may also abort the shutdown (since you are not forcing it), maybe your system does not support the power-off feature or your program... |
Forum: C++ Mar 19th, 2009 |
| Replies: 2 Views: 397 What on earth "TP and others" means? |
Forum: C++ Mar 18th, 2009 |
| Replies: 9 Views: 455 There is a contradiction, in your first post you say that "Each file has: #include "include.h"". If enum.cpp actually includes include.h, that results in the error you described.
Assuming... |
Forum: C++ Mar 18th, 2009 |
| Replies: 23 Views: 981 Now remember the second parameter to write(), that specifies how many bytes are written.
PS. Maybe you could try to re-post your code |
Forum: C++ Mar 16th, 2009 |
| Replies: 4 Views: 225 Learn how to use code tags (http://www.daniweb.com/forums/announcement8-3.html), without code tags, your code is pretty much unreadable.
If you expect to be helped, shouldn't you ask a question? |
Forum: C++ Mar 16th, 2009 |
| Replies: 23 Views: 981 It seems that you are desperately trying various ways to write the file.
Maybe relax and try to master e.g. a binary .pnm file of a very small size, say 2x2 pixels hence being easily viewed in... |
Forum: C++ Mar 16th, 2009 |
| Replies: 17 Views: 1,150 Umm, maybe you misunderstood me (?). I was not trying to say that MSVC 6.0 cannot be used on Windows versions later than "Windows Server 2003".
Instead, I was trying to say that the "Windows... |
Forum: C++ Mar 16th, 2009 |
| Replies: 17 Views: 1,150 You might look at Using Visual C++ 2008 Express with the Windows SDK (http://blogs.msdn.com/windowssdk/archive/2008/02/22/using-visual-c-2008-express-with-the-windows-sdk-detailed-version.aspx) |
Forum: C++ Mar 16th, 2009 |
| Replies: 17 Views: 1,150 Don't ever replace/modify the system header files, instead simply get a complete SDK, which is guaranteed to be compatible with your compiler. |