164 Posted Topics

Member Avatar for hotness

It looks like you're trying to get us to solve your homework for you. If you have specific questions about the theory or mechanics behind any one question, I'll be happy to [I]help[/I]. I'm not going to [I]solve[/I] specific homework problems for you.

Member Avatar for hotness
-1
343
Member Avatar for Andreas5

The problem is (most likely) that you have to define a template function in the same file where it is declared. For a good over-view and specifics on the multi-file problem, see [URL="http://www.cplusplus.com/doc/tutorial/templates/"]this[/URL]. So, you need to move your implementation of the split2 function to your header file. I know …

Member Avatar for jonsca
0
183
Member Avatar for rayborn66

Please post your input file. I think you are getting the value of an unitialized variable. In c and c++, when you declare a variable like: [code] int someVariable; [/code] The program is simply reserving an int sized memory block somewhere on the stack. Please note, the program only [I]reserves[/I] …

Member Avatar for rayborn66
0
289
Member Avatar for newstar_water

[QUOTE=newstar_water;5239]Hello, I need to know how the get the integer value of a byte and vice versa.[/QUOTE] As the first respondent answered in [I]unformatted[/I] code, it's as simple as a cast. I would additionally point out that it is useful to understand the type system in c++. There are several …

Member Avatar for dusktreader
1
4K
Member Avatar for vbx_wx

[QUOTE=Taywin;1264010]Doubly linked list should never point to a NULL. [/QUOTE] That's not true. The HEAD node of a doubly linked list (DLL) should have its PREV pointer set to NULL. The TAIL node of a DLL should have its NEXT pointer set to NULL. Otherwise, how could you determine if …

Member Avatar for dusktreader
0
3K
Member Avatar for emcyroyale

[QUOTE=Taywin;1264305]If a function is void, the only way you can display the result is to write to console immediately right after the calculation. In this case, while you are displaying each row, at the last column, which is the letter grade, call the function (may pass in total score depending …

Member Avatar for Taywin
0
113
Member Avatar for Chaos3737

You should also only seed the random number generator once early in the lifecycle of the program. time() measures seconds, so if you seed twice in the same second, the generated numbers will be the same.

Member Avatar for arkoenig
0
152
Member Avatar for fenerista

You need to first realize that there is no [][] operator. In fact whenever you see matrix2D[][] or matrix3D[][][] or matrixND[][]...[], you are actually seeing multiple nested calls on the [] operator. Consider the case for a 2D matrix. If you declare the matrix like so: int rows = 5; …

Member Avatar for fenerista
0
130
Member Avatar for Isabelle

You need to declare the static member outside of the class definition like so [code] #ifndef DIE_H #define DIE_H #include "aRandomNumberGenerator.h" class aDie { public: aDie(); double roll(); void seed (int s); int inputSeed(); ~aDie(); private: static aRandomNumberGenerator gen; }; #endif #include <iostream> #include "aDie.h" #include <cmath> using namespace std; …

Member Avatar for Isabelle
0
153
Member Avatar for Sandhya212

[QUOTE=Sandhya212;1224739]Hi, I have code as follows wherein I pass a 2D array to a function and want to receive this array with its contents tripled. The error I get is 'error: cannot convert 'int (*)[4]' to 'int**' in return'. I was able to send and receive a 1D array using …

Member Avatar for Sandhya212
0
459
Member Avatar for kiramat khan

[QUOTE=kiramat khan;1224850]i need to the code for drawing square[/QUOTE] Here's a better link for you: [URL="http://www.daniweb.com/forums/thread78223.html"]You need to the rules for posting questions[/URL]

Member Avatar for dusktreader
-2
79
Member Avatar for sandorlev

My first recommendation would be to use Python exclusively. Python is a fully-featured programming language with thousands of libraries for doing just about everything. There are 3 principle GUI toolkits for Python. These are PyQt, wxPython, and Tkinter. PyQt (my preference) and wxPython are very powerful and higly supported. Tkinter …

Member Avatar for dusktreader
0
244
Member Avatar for dusktreader

I ran into this particular problem at work and found it quite interesting. While implementing a multi-level image threshholding algorithm, I discovered that I needed to find all the ways I could partition a range of integers into some number of consecutive groups. I like my solution, but there may …

Member Avatar for dusktreader
0
439
Member Avatar for codename.heaven

I know this thread is cold, but I recently had this problem myself. There is no round function in <cmath> for windows. Instead, you have to implement it yourself. This is rather easy, however: [CODE] inline double round( double d ) { return floor( d + 0.5 ); } [/CODE] …

Member Avatar for dusktreader
0
1K
Member Avatar for dusktreader

The essential problem is to determine the index i of the first Fibonacci number Fn to have at least d digits. The specific challenge is to determine the index of the first Fibonacci number to have 1000 digits. Obviously, this problem could be brute forced by stepping through all the …

Member Avatar for dusktreader
0
151
Member Avatar for MyrtleTurtle

Are you not allowed to use cin to get whole strings from an input file? [icode] cin >> someString; [/icode] If you are, you could fetch an entire string at a time and process each string individually.

Member Avatar for MyrtleTurtle
0
125
Member Avatar for caffeine

> I have a bunch of code that looks like: // Local block scope { ostringstream ostr; ostr.fixed; ostr.precision(2); ostr.width(20); ostr << foo->bar[trno]; SafeArrayPut2D( retArray, 3, i, (void *) ostr.str().c_str() ); } { ostringstream ostr; ostr.fixed; ostr.precision(4); ostr.width(22); ostr << foo->foobar[trno]; SafeArrayPut2D( retArray, 4, i, (void *) ostr.str().c_str() ); } …

Member Avatar for dusktreader
0
179
Member Avatar for V0ldemort

[QUOTE=V0ldemort;1174852]How can I access (get) the individual pixels of the data in an LPDIRECT3DTEXTURE9? Thanks.[/QUOTE] Well, your first step would probably involve asking this question in a more appropriate forum: [URL="http://www.gamedev.net/community/forums/topic.asp?topic_id=508563&whichpage=1�"]"LPDIRECT3DTEXTURE9 get pixel"[/URL] [URL="http://forums.xna.com/forums/p/7691/40893.aspx"]"How to get the color of one pixel of shadow map"[/URL]

Member Avatar for dusktreader
0
75
Member Avatar for paraboloid

[QUOTE=paraboloid;1175134]I'm making a red black tree (RedBlack class) whose nodes will contain customers (customer class) rather than the generic int data. Unfortunately, I can't seem to get VS 2008 Express recognize that data is of type customer. I get all sorts of redefinition errors, and I've tried pragma once and …

Member Avatar for dusktreader
0
122
Member Avatar for calypso8

[QUOTE=calypso8;1153070]Hi, I am fairly new to C++ but love to learn, so I wanted to create a simple program base on the group-party game mafia A.K.A "werewolf." Just so whoever is not familiar gets the background. I will use just an example of 10 players. In a ten player game, …

Member Avatar for calypso8
0
1K
Member Avatar for dolly_olaide

This sounds like a computer vision problem. This [I]is[/I] an ambitious project, though not at all impossible. Like @tetron suggested, you should do [I]a lot[/I] of reading first. Then you might want to check out [URL="http://opencv.willowgarage.com/wiki/"]OpenCV[/URL]. OpenCV is a [I]powerhouse[/I] foss computer vision library that is really great at doing …

Member Avatar for dolly_olaide
0
169
Member Avatar for mani_singh

[QUOTE=mani_singh;1148964]i am trying to make a program where a user inputs two numbers. the first number needs to be less then the second. then the program needs to add all the numbers together that fall between those two numbers including the two numbers. for example number1 = 1, number 2= …

Member Avatar for WaltP
0
255
Member Avatar for merse

[QUOTE=Fbody;1149869]I found it pretty easy. [URL="http://www.lmgtfy.com/?q=c%2B%2B+isnan+function"]Check this link.[/URL][/QUOTE] Thanks a lot, Fbody....There goes my productivity for this morning...

Member Avatar for dusktreader
0
106
Member Avatar for Carrots

[code] case 'a': { //Create an object and return a pointer to that object //(I will be making many of these objects) [B]Base::ReturnPtrToANewBaseClassObject();[/B] //push the returned pointer onto the std::list BaseList.push_back( ptr ); cout << "Object now pushed onto list" << endl; break; } [/code] This is the way that …

Member Avatar for Carrots
0
173
Member Avatar for BobC22

Please post the nature of your errors ( syntax, logical, segfault, etc ) as well as your compiler/application output.

Member Avatar for mrnutty
0
169
Member Avatar for tararengan

[QUOTE=tararengan;1147303]can I call a function B outside a class (say, a global function) from a member function Aof that class? if so, how do I specify the scope? Using :: B ? thanks.[/QUOTE] If B() is truly global, you call it like this ( brace yourself ) [icode] B() [/icode]. …

Member Avatar for mrnutty
0
117
Member Avatar for sexyzebra19

Since your 2D data is being stored in 1D arrays, all you need to do here is play indexing games. Suppose you had a matrix of MxN stored in a 1D array M*N in length. If the matrix is stored in column major order, and you need to convert it …

Member Avatar for sexyzebra19
0
2K
Member Avatar for coachkrzyzewski

[QUOTE=coachkrzyzewski;1146211]I'm making a binary expression tree, and to do so I'm reading in values and putting them into a tree node and a pointer to that tree node into a stack. How do I use the STL stack implementation with pointers to my TreeNode class? relevant code: [CODE] stack<TreeNode> s; …

Member Avatar for dusktreader
0
167
Member Avatar for Asalearam

I got excited for a chance to share my love of Qt. Then I saw what the OP wrote... I don't know that he meant to be rude. Perhaps it is a language barrier thing? He did say please.... Anyway, your questions for this forum need to be specific and …

Member Avatar for Stefano Mtangoo
0
541
Member Avatar for rwill357

[QUOTE=Krstevski;1142852]You can not determine the time of execution[/quote] You [I]can[/I] determine the time of execution. While the time [I]is[/I] dependant on system load and hardware, you can still get an idea of performance using timing methods. After all, that's what they do in the industry to compare software. The easiest …

Member Avatar for niknailer
0
132
Member Avatar for sgw

[QUOTE=sgw;1142908]Here is the simplest program: [CODE]#include <iostream> using namespace std; int main() { cout << "hello" << endl; cin.get(); return 0; }[/CODE] When I ran it (using Dev C++), there is no output, just a blank screen. The problem seems to be from the "endl". If I delete it, or …

Member Avatar for ppl154
0
141
Member Avatar for TheWolverine

[QUOTE=TheWolverine;1142070]Hi all, I've spent the last week trying to sort this out, and the more I delve into it, the more confused I'm getting. I've done some background research (searched on google and here for sort function issues) and really I can't make head or tail of what's going on.[/QUOTE] …

Member Avatar for dusktreader
0
4K
Member Avatar for TheWolverine

[QUOTE=TheWolverine;1136101] I would appreciate if someone could help me sort out how to do this with accumulate (and also then how best to raise all of the vector elements to the exponent value before submitting them to the function). If not with accumulate, I'd appreciate any advice on how to …

Member Avatar for dusktreader
0
150
Member Avatar for Robyy14

[QUOTE=Robyy14;1140705]don't redirect me to a site that already made a library for this because you only wasted your time telling me that.[/QUOTE] Here's some redirection for you: [URL="http://www.daniweb.com/forums/thread557.html"]show effort[/URL] I'm feeling generous, so I'll give you a little hint. [B]Use doubles[/B].

Member Avatar for dusktreader
0
147
Member Avatar for TheWolverine

[QUOTE=TheWolverine;1129979] I do want to setup my environment such that there is a possibility of adding attributes in the future, so from that perspective it seems that using a class might not be a bad idea. [/quote] You should probably spring for some type of object in this case. Though, …

Member Avatar for TheWolverine
0
172
Member Avatar for caramel

[QUOTE=caramel;1140772]I apologize for taking me so long. I was awaiting a response from my teacher. This is what I have so far. /QUOTE] 1. You really need to use code tags. Read the posting rules. It's easier to get help if you follow the posting rules. 2. If you are …

Member Avatar for dusktreader
0
974
Member Avatar for sexyzebra19

[QUOTE=n1337;1139713] So the question is... how do you extract the column and row vectors using your particular representation of a matrix?[/QUOTE] You wrote a bunch of information that didn't answer the question and then re-asked to OP's question. OP: you can think of representing a 2D matrix in 1D as …

Member Avatar for dusktreader
0
154
Member Avatar for techie929

[QUOTE=techie929;1139745]/*I am getting the following errors free.cpp: In function 'int main()': free.cpp:24: error: expected `;' before 'obj' free.cpp:25: error: 'obj' was not declared in this scope free.cpp:25: error: expected primary-expression before 'int'][/QUOTE] free is a reserved keyword in c++ and c. You need to name your class something else.

Member Avatar for techie929
0
261
Member Avatar for dusktreader

In my application, i currently make many (parallel) calculations based on a time parameter. The calculation is a parametric function of time, so, each time value renders a unique solution. Currently, I have many threads that are calling the same calculation function, and the time parameters are often the same. …

Member Avatar for dusktreader
0
291
Member Avatar for doddware

[QUOTE=doddware;1129087] We can't use the optimizer (managerial decision, because people don't know how to use [COLOR="Red"]volatile[/COLOR], a different discussion). This is the first time I've ever seen this and I'm interested in any reasoning why we shouldn't just remove it to eliminate code bloat.[/QUOTE] It sounds like you might be …

Member Avatar for Salem
0
185
Member Avatar for skorm909

I like to use a macro for this sort of thing: [code] #define RAND_INT( low, high ) ( rand() % ( high - (low) + 1 ) + low ) [/code] you would put that near the beginning of your code (right after your #includes ). Then, you can simply …

Member Avatar for skorm909
0
418
Member Avatar for RayvenHawk

[QUOTE=RayvenHawk;1133892]Displaying them in all possible unique combinations is what I'm looking for. Can you give an example of how to accomplish it?[/QUOTE] You're asking for a solution to your homework? I'll give you a hint: Depth First Search.

Member Avatar for dusktreader
-1
88
Member Avatar for corby

[QUOTE=jonsca;1133922] Honestly, it's almost less work to do it the way you have it there.[/QUOTE] Maybe ( i actually disagree ), but that solution wouldn't extend very well at all. OP: think about how you would mentally walk over a matrix visiting every element. Think about the system you use …

Member Avatar for mrnutty
0
111
Member Avatar for bbabarajj

[QUOTE=bbabarajj;1134001]hi i am trying to write a simple calculator.i have posted the code below,it works fine for one time solution. but i want the answer to be used for next calculation and also want to put a code to end the program.[/QUOTE] 1. You need some variable that will store …

Member Avatar for dusktreader
0
121
Member Avatar for KRal

You should also consider using a better reduction algorithm. I think you probably don't know about Euclid's Algorithm. It would be very helpful for this problem, and you would have to test every value in the interval ( 1, a*b ]. [URL="http://en.wikipedia.org/wiki/Euclidean_algorithm"]Euclid's Algorithm[/URL]

Member Avatar for dusktreader
0
121
Member Avatar for hirafaryal

First of all, you need to have the image data stored in some sort of serially accessible data structure. Lets suppose that you have the image data in an array of floats. Next, you need to scale your data to a specific range. Often, this range is the interval [0,1.0). …

Member Avatar for dusktreader
0
91
Member Avatar for dusktreader

I have a class hierarchy in which the base class is abstract. Each derived class has a set of private members which describe parameters that control how the class processes data. I want to enforce implementation of a setParams() function across all derived classes. However, because the parameters for each …

Member Avatar for dusktreader
0
271
Member Avatar for moein_soltani

[QUOTE=moein_soltani;1129571]Hi guys.. In the huffman algorithm I have made an output file contain 0 and 1.. how can I say to compiler that these 1 and zero are bit no Byte. and how can i make the real Huffman output that its size is lesser than the initial file, What …

Member Avatar for moein_soltani
0
104
Member Avatar for AmigaCarolena

Before you try to tackle the whole problem at once with code you are not sure of, you should try to create a 'toy' problem with only a few lines of code that uses the concepts you need to perfect. In your case, you need to learn about how cin …

Member Avatar for EngSara
-2
141
Member Avatar for mrnutty

Some of your words have trailing spaces. This results in some un-fun! [icode] Mystery Word : numerical* Guessed letters : e,i,t,s,l,a,o,d,n,m,u,r,c,y,z,b,f,g,h,j,k,p,q,v,w,x, Guess number : 26 Enter a letter : [/icode] I was having fun until I realized that numerical didn't fill the word. What begins with numerical and ends in …

Member Avatar for mrnutty
1
290

The End.