190 Posted Topics

Member Avatar for bugmenot

Hi everyone, I'm trying to write a stored procedure select statement which is a little beyond my experience level. I have a table in the DB called addresses which contains the following fields: [LIST] [*]address, VARCHAR [*]count, INT [*](a few more fields) [/LIST] My stored procedure will take in a …

Member Avatar for huangzhi
0
104
Member Avatar for bugmenot

In c++ i want to know how to output the result on dos screen page wise,i.e. when i am displaying something if the page is filled then a prompt should come like "Press any key to continue.." More precisely i want an equivalent of the '/p' command which is used …

Member Avatar for Frederick2
0
99
Member Avatar for bugmenot

Today when i woke up and turned on my computer, the XP loading screen (with the three blue blocks always going) stayed like that and never changed. i tried running my comp in start mode, but 2-3 seconds after i see the login screen, my computer restarts. what should i …

Member Avatar for ragnar
0
83
Member Avatar for jack1234

[QUOTE=Ancient Dragon;631862]You are using a compiler with the world's best debugger. You don't need debug messages. Just compile your program for debug and use the debugger to set breakpoints, see the value of variables and program execution.[/QUOTE] This isn’t entirely true. While the debugger is great for most apps, there …

Member Avatar for bugmenot
0
3K
Member Avatar for avian
Member Avatar for imtnan

void function(int& aaa[][], int 1d, int 2d) { for(int i=0; i<1d; i++) { for(int j=0; j<2d; j++) { aaa[j] = i*j; } } } This is wrong, for many reasons. First, this is an array of arrays of references. The caller is not going to be able to pass a …

Member Avatar for dougy83
0
3K
Member Avatar for zoner7

[QUOTE=zoner7;621213]My suspicion is that, in the below code, the continue statements effectively do nothing and put my code right before the return false statements.[/QUOTE] No. "continue" skips the remaining iteration of the loop (in this case, the for loop). So it goes directly to the "n++" step, and then starts …

Member Avatar for bugmenot
0
1K
Member Avatar for henpecked1

[QUOTE=henpecked1;622552]ahhh I see. Now if I wanted to call pedal from cycle, but within bicycle, I think I can do it by just putting cycle::pedal(); in bicycle's member function pedal. Is there another way to do it? (I did this in a door class with a door open member function, …

Member Avatar for bugmenot
0
143
Member Avatar for rayomand

you can compute it by dividing by 100 (removes the last 2 digits) and then mod'ing by 10 (only keeps the last digit) (x / 100) % 10

Member Avatar for bugmenot
0
49
Member Avatar for faust_g

[QUOTE=faust_g;621576][code=CPP] //vector initialized to allocate 10 string objects vector<string> *pvec1 = new vector<string>(10); delete pvec1;[/code][QUOTE=faust_g;621576] I am not sure what you mean by "allocate 10 string objects". There are no string objects here at all. This is just a special functionality of vectors that reserves enough space to hold 10 …

Member Avatar for Radical Edward
0
146
Member Avatar for Alex Edwards

Reflection. you need it when you want to invoke a method by reflection. A method does not have to be public to be invoked. However, you will need to know how to get it. (Class.getMethod() will not work, it only works for public methods; Class.getDeclaredMethod() will work)

Member Avatar for dkerberwra
0
86
Member Avatar for msupstream

If there is truly a legitimate reason for a subclass to want to access a field, it should be declared "protected".

Member Avatar for msupstream
0
197
Member Avatar for Egypt9

The standard way to do it with inheritance is probably to have an array of Employee pointers [code]Employee* employees[10];[/code] (You can also dynamically allocate it if you really wish. It will be like [code]Employee** employees = new Employee*[10];[/code] ) and then put whatever employees you want in there [code]employees[0] = …

Member Avatar for Egypt9
0
81
Member Avatar for zawpai

[QUOTE=niek_e;616629]Well.... ok, but just this once ;) Private means that the variable is only accessible [i]inside[/i] the class. Public means it can be accessed by anyone. Here's an example to make things clearer: [code=cpp] class DistSign { private: int priv; public: int publ; void ShowMe(void) { std::cout << "private: " …

Member Avatar for Nick Evan
0
319
Member Avatar for Kadence

[QUOTE=Kadence;617161]Is there any programming reason why I always see function definitions with arguments like this: [CODE]char getchar(char *arr){[/CODE] Instead of this?: [CODE]char getchar(char arr[]){[/CODE][/QUOTE] These are identical. It is a pointer in both cases. So I guess it may be more clear to write it as a pointer. The second …

Member Avatar for Salem
0
205
Member Avatar for toolbox03

[QUOTE=Duoas;613105][code=C++] template<typename T, typename U> void print_first_five( map<T,U> m ) { for (int i = 0; i < (m.size() >= 5) ? 5 : m.size(); i++) cout << m[i].second; } [/code] Hope this helps.[/QUOTE] This is wrong, by the way. "m[i]" looks up "i" as a key in the map. …

Member Avatar for Duoas
0
110
Member Avatar for Alishaikh

it's right. vector doesn't have a method named "length()". it does have a method named "size()".

Member Avatar for bugmenot
0
106
Member Avatar for midimatt

[QUOTE=midimatt;607136]what i was thinking was could i just do [code=c++] vertices = new float[v][3]; [/code][/QUOTE] this one only works if the "3" part is a constant, and always creates a "rectangular" array made of contiguous parts, no pointers involved

Member Avatar for bugmenot
0
132
Member Avatar for flash121

[QUOTE=flash121;606942]Doesn't work :( .[/QUOTE] Next time, at least put in minimal effort and post an error or something; instead of other people repeatedly posting suggestions, and you just saying "doesn't work" each time without any clue as to what doesn't work.

Member Avatar for bugmenot
0
138
Member Avatar for paradox814
Member Avatar for bugmenot
0
279
Member Avatar for daniel88

Also, a fundamental problem with your grow() function: void grow(int array[], int newnumber, int oldsize) { //... array = temp; // swap contents back to array } The last line is completely useless, because "array" is a local variable, assigning it has no effect outside the function.

Member Avatar for Radical Edward
0
137
Member Avatar for kse989

So these are all very self-explanatory. What part of the errors don't you understand? [QUOTE=kse989;603190]Tree.cpp:95: error: no matching function for call to `TreeType<int>::Find(int&)' bintree.h:235: note: candidates are: void TreeType<ItemType>::Find(ItemType&, bool&) [with ItemType = int][/QUOTE] Apparently Find() takes two arguments (a bool reference as a second argument) and doesn't return anything; …

Member Avatar for kse989
0
133
Member Avatar for zsamus.love

the second and fourth const are utterly and completely pointless. there is never a point to declare that a value passed by value is not going to be modified. you should remove them

Member Avatar for bugmenot
0
88
Member Avatar for want_somehelp

static local variables and static data members have lifetimes like global variables (there is only one copy in the program, and it exists for the whole duration of the program), except that their scope is not global

Member Avatar for vijayan121
0
466
Member Avatar for Lotus_2011

sum should be set to 0 at the beginning of every iteration of the outer loop and i is only incremented at every block of three, so "bin[i]" is the same all three times

Member Avatar for William Hemsworth
0
139
Member Avatar for daviddoria

[QUOTE=Ancient Dragon;598387]1) when using vectors you can access individual elelements just as you would do with a simple int array [icode]B = LiDARGrid.ConcentricScans.[scancounter].getColumn(concentriccol);[/icode][/QUOTE] except that it doesn't check bounds

Member Avatar for mitrmkar
0
192
Member Avatar for henpecked1

[QUOTE=henpecked1;597636][code]sphere::sphere() //default constructor { int Radius=0; }[/code][/QUOTE] wow. what did you expect that code to do?

Member Avatar for bugmenot
0
152
Member Avatar for complexcodes

[QUOTE=complexcodes;597738][CODE]opOverload obj1 = (10,20); opOverload obj2 = (30,40);[/CODE][/QUOTE] should probably be [CODE]opOverload obj1(10,20); opOverload obj2(30,40);[/CODE]

Member Avatar for bugmenot
0
100
Member Avatar for bhoot_jb

just download it from the sourceforge project [url]http://sourceforge.net/projects/dev-cpp/[/url]

Member Avatar for bhoot_jb
0
156
Member Avatar for Karkalash

you could either get all the digits out into a list or something, and then parse them back into a number in reverse or just take the input as a string and reverse the string

Member Avatar for peter_budo
0
111
Member Avatar for NeroMaj

you need to make the method in the base class [B]virtual[/B] [url]http://en.wikipedia.org/wiki/Virtual_function[/url]

Member Avatar for NeroMaj
0
105
Member Avatar for Project_Panda

if you need to delete arbitrary elements a lot, then perhaps you don't want to use a vector, because it is very expensive, both to find it and to shift all the remaining elements

Member Avatar for Project_Panda
0
146
Member Avatar for zawpai
Member Avatar for zawpai
0
112
Member Avatar for y25zhao

a completely literal translation into C++ would be like this: [CODE]class Node{ private: void *item; Node *next; public: Node(void *obj) : item(obj) { } void *getItem() const { return item; } Node *getNext() const { return next; } void setItem(void *obj) { item = obj; } void setNext(Node *n) { …

Member Avatar for vijayan121
0
143
Member Avatar for soup
Member Avatar for bustedsfnewkia

start with this [code]bool discr(double array2[3], double &result)[/code] do you know how to use c++ references?

Member Avatar for littlestone
0
105
Member Avatar for Cosa

[QUOTE=Cosa;592662][code]float* matrixa = new float(6);[/code][/QUOTE] you probably wanted [code]float* matrixa = new float[6];[/code]

Member Avatar for Cosa
0
241
Member Avatar for abdulraqeeb33

why don't you post the exception and stack trace, and post the code inside code tags

Member Avatar for abdulraqeeb33
0
244
Member Avatar for MjLaali

no, it is better that you make the class a functor class (its has an overloaded function call operator); and then you should template the sort function, so it can either take a function pointer or a function object [code=C++] int compare(int a, int b) { return a - b; …

Member Avatar for bugmenot
1
135
Member Avatar for ok555

The first piece of code works because "mtab" is an [B]statically-sized array[/B] which the compiler knows the size at compile time. (The macro is just a convenient compile-time trick.) The second piece of code doesn't work because "myclass->smath" is a [B]pointer[/B], and there is no way to tell how many …

Member Avatar for ok555
0
183
Member Avatar for beatlea

[QUOTE=beatlea;588200]It says 'This will allow to practice with ArrayList and allow you to use generics, if you wish.'[/QUOTE] Well are you using Generics? Maybe you should. [url]http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html[/url]

Member Avatar for beatlea
0
173
Member Avatar for WalkmanXD

in java objects are always referred to using "references", which are kind of like pointers in C, except that you can't do silly stuff with them

Member Avatar for jwenting
0
248
Member Avatar for littlestone
Member Avatar for hgedek

You can't really delete an arbitrary item from a priority queue easily; only the item with the highest priority. Maybe you should read up on what priority queues are: [url]http://en.wikipedia.org/wiki/Priority_queue[/url] The items in the priority queue (implemented as a binary heap) have some structure, but are not in sorted order; …

Member Avatar for vijayan121
0
305
Member Avatar for KimJack

[QUOTE=KimJack;584103][code] if(hash.containsKey(hash.get(info)))[/code][/QUOTE] This line makes no sense; you are getting the value that is associated with the key "info", and then you are testing whether that value is a key in the hash table?

Member Avatar for KimJack
0
95
Member Avatar for l2u
Member Avatar for bugmenot
0
216
Member Avatar for kse989

[QUOTE=kse989;581988] stream << rear[counter] << " ";[/QUOTE] um... how the hell do you expect this to work? this is a linked list, not an array; you cannot index it like that; you have to traverse the links

Member Avatar for Ancient Dragon
0
186
Member Avatar for Ben10

result is set to 10 in the last iteration of the first for loop and then you assign result (10) to every element of your 2-d array in the other for loops

Member Avatar for Ben10
0
88
Member Avatar for scaraffe
Member Avatar for Salem
0
104
Member Avatar for debee
Member Avatar for debee
0
498

The End.