2,712 Posted Topics

Member Avatar for maverick405

1)Draw the top border 2)Draw the first '*' and follow it up with space 3)Repeat 2 until end 4) Draw the bottom border Maybe this will help : [code] void drawB() { const int C = 4; const int R = 4; for(int i = 0; i < R; i++) …

Member Avatar for yasy
0
5K
Member Avatar for masamune

Well the point is to learn how to code function and not learn how to use the java library. Although later on you will almost always. Here is some psuedo code that might help: [code] Function max(a,b,c) max(a,b)->x return max(c,x) End Function Function min(a,b,c) min(a,b)->x return min(c,x) End Function Function …

Member Avatar for jon.kiparsky
0
108
Member Avatar for t_mac219
Member Avatar for soccer13

I'm not sure what you mean, post example of what you have and possibly what you are trying to achieve.

Member Avatar for jon.kiparsky
0
364
Member Avatar for vJeel

Why are you using anonymous functions? Its very unclear. Also your start action listener is wrong I think. It goes into an infinite loop.

Member Avatar for mrnutty
0
186
Member Avatar for ace8957

As of right now, C++ does not allow you to separate template header and its definition. You need to put the template definition in the same file as the header.

Member Avatar for ace8957
0
414
Member Avatar for AlvinLiu
Member Avatar for gnanasemantic
0
120
Member Avatar for burcin erek

So the easiest thing for you todo is make this into classes. I'm guess you don't know about classes that much. So the next best thing you can do is make this into functions. Here is a brief skeleton. [code] //#include everything int main(){ const int MAX_COLORS_TO_GUESS = 4; string …

Member Avatar for mrnutty
0
137
Member Avatar for KLane

You don't call Accumulate anywhere. Call it inside your constructor.

Member Avatar for mrnutty
0
118
Member Avatar for Neo63

My guess is that you need to override [I]indexOf(Object obj);[/I] Post your code including the imports.

Member Avatar for apines
0
139
Member Avatar for rcossy1023

The only way that loop terminates is if [i]result = true and current.getNext() = null[/i]. What you want is the binary AND logical operation not the binary OR logical operation. Also there is no need for [i]line 10[/i]. result will stay false unless it is true, and if it is …

Member Avatar for mrnutty
0
98
Member Avatar for muncher10
Member Avatar for joehms22
-2
84
Member Avatar for alaa sam

If you do not go towards the better solution of using the above links, then what you want is to use an array. Work by digit by digit.

Member Avatar for alaa sam
0
87
Member Avatar for BladeCoder

This sounds like an h.w or an exercise, so doing this : [code] std::sort( name, name + SIZE ); int pos = std::binary_search(name, name +SIZE, "JOSH"); [/code] would not be beneficial. And as pointer out, the string class overloads the relational operators, so that means all you have to do …

Member Avatar for ritasea
0
1K
Member Avatar for Weird Nerd

umm, haven't done opengl for a while, but I think you are looking for [B]gluPerspective(..)[/B]. Its areguments are the following [code] void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); [/code] So just specifiz zNear to be some negative number and zFar to be an adequate high number and …

Member Avatar for Weird Nerd
0
514
Member Avatar for mike_2000_17

I always find myself using the template pattern. The decorator pattern is pretty elegant. Just some thought, visitor pattern is rarely used, at least for me. And usually, unless its the rare case, using Singleton Pattern is not the answer. Factory patterns are ok. They're nothing unusual. But for the …

Member Avatar for mrnutty
0
212
Member Avatar for richardcyper
Member Avatar for mrnutty
0
52
Member Avatar for Mellopv13

[URL="http://en.wikipedia.org/wiki/Euclidean_algorithm"]http://en.wikipedia.org/wiki/Euclidean_algorithm[/URL]

Member Avatar for mlesniak
0
87
Member Avatar for maverick405

[QUOTE=Clinton Portis;1052806]For most assignments of this nature, most go with storing user input into a cstring.. then use a loop to display the contents of the string in reverse order. Simple. Straight-forward.[/QUOTE] I think he means something like this : [code] Enter 10 numbers : 10 9 8 7 6 …

Member Avatar for Rootz
0
154
Member Avatar for slychronic
Member Avatar for Hayzam_#include

[QUOTE=Hayzam_#include;1391052]hi I wonder who is the smallest boy to know any low level programming language Eg:C++ or java etc exept the qbasic[/QUOTE] Wow that might be the most non-intellectual question I have read on this forum. You should get a prize or a cookie.

Member Avatar for jonsca
-2
179
Member Avatar for mrnutty

[B]Problem statement:[/B] Give two sets [TEX]A[/TEX] and [TEX]B[/TEX], devise and algorithm that checks if A and B are [URL="http://en.wikipedia.org/wiki/Disjoint_sets"]disjoint[/URL]. The following information are given about the set [TEX]A[/TEX] and [TEX]B[/TEX]: [LIST=1] [*][TEX]|A| = |B| = n[/TEX], that is number of elements in both sets are n [*]A and B are …

Member Avatar for arkoenig
0
102
Member Avatar for phoenix1095
Member Avatar for tfmontague

ummm, not sure why but how about this idea: [code] struct EmptyType{} template<typename T1,typename T2 = EmptyType(),...and so on for some finite amount> struct TupleType{ typedef type1 T1; typedef type2 T2; //...and so on } int main(){ Tuple<int,bool,char,string> Tuple::type1 intType = 0; Tuple::type2 boolType = false; //... } [/code] What …

Member Avatar for alwaysLearning0
0
192
Member Avatar for merse
Member Avatar for michal_nowak
Member Avatar for mrnutty
0
141
Member Avatar for low_coder

I think you need to look at your design again. For some reason what you are doing doesn't seem like a good way to go about it. I would suggest an alternative but, I'm not completely sure how your code works.

Member Avatar for low_coder
0
143
Member Avatar for Nathaniel10

>>[B]Secondly the program is well structured, but only one class??? [/B] I beg to differ. Its hard to read. Global variables, overly complicated, and definitely not well structured.

Member Avatar for Nathaniel10
0
148
Member Avatar for Nathaniel10

Before resorting to inheritance, can you state your actual problem with some actual context? Maybe you have been going about this problem wrong?

Member Avatar for Nathaniel10
0
153
Member Avatar for modesto916

almost, e = 1/0! + 1/1!... so you have to add 1/0! = 1 to each output. [URL="http://upload.wikimedia.org/math/a/1/0/a10a05335ccb3b560a678ed2dd287fdb.png"]taylor series representation of the constant e[/URL]

Member Avatar for modesto916
0
175
Member Avatar for NathanMc

[CODE]George Bush 70 77 Barack Obama 70 75 80 Bill Clinton 68 70[/CODE] Does the general format goes like so : [code] FirstName LastName score1 score2 ... scoreN [/code] or are there only score1 and score2 for all names? Either way you should do something like so : [code] struct …

Member Avatar for hag++
0
175
Member Avatar for burcin erek

change this [icode]calculation function_one(calculation addition)[/icode] to this [icode]calculation function_one(calculation& addition)[/icode] and realize the difference.

Member Avatar for burcin erek
0
100
Member Avatar for watery87

If you want that then you need to have a fraction class that handles that. So that instead of just displaying its floating values, it can display the numerator and denominator. Thus ultimately, you need to keep a variable for the numerator and denominator. So instead of [icode]double re,im[/icode] you …

Member Avatar for mrnutty
0
214
Member Avatar for tomtetlaw

Ex: Absolute position: [icode]monster.setPosition(100,100); [/icode] Relative position: [icode]hero.setPosition(monster.getX()+100,monster.getY()+100)[/icode] So in the absolute position, the monster in place in an absolute position at (100,100), while the hero is placed relative to the monster, that is the hero is placed 100 plus the monster x position and 100 units plus the monster …

Member Avatar for mrnutty
0
96
Member Avatar for ottilie

Take for example the call result(3). Trace the recursion out and get: result(3) = result(2)*2 = result(1)*2 * 2 = 2*2*2 = 8 So you see calling result(3) calls result(2) which calls result(1). Thus there are 3 calls to result n. If you try to generalize it, you will see …

Member Avatar for apines
0
129
Member Avatar for totalwar235

[code] string Direction = "i"; [COLOR="Red"]cin>>Direction;[/COLOR] [COLOR="red"]while((Direction != "L")||(Direction != "l"))[/COLOR] [/code] Make similar changes. Use Direction as an string object, not as a string array.

Member Avatar for totalwar235
0
91
Member Avatar for aaronmk2

@OP: Forget you ever saw that code. Its useless.This [iCODE]insertion-sort_recur(a, n-1);//how does this line work[/iCODE] acts like a for loop. It keeps going until it reaches the second element. Then it returns to the third element. Then to the fourth and so on...

Member Avatar for mrnutty
0
1K
Member Avatar for wmc++

What exactly do you need help with? Maybe a kick start would help. Here is some ideas: [code] class Cash{ private: int money[10]; public: enum {PENNIES,NICKELS,DIMES,QUARTERS, ONE_DOLLAR,FIVE_DOLLAR,TEN_DOLLAR,FIFTY_DOLLAR,ONE_HUNDRED_DOLLAR public: Cash(){ for(int i = 0; i < 10; ++i) money[i] = 0; } void add(const Cash& money){/*Add code here*/} void subtract(const Cash& …

Member Avatar for mrnutty
0
586
Member Avatar for Mehwish Shaikh

make initCheck a static method. Do you know what the term static mean in the context of programming?

Member Avatar for maclord
0
368
Member Avatar for Sohelp

[img]http://upload.wikimedia.org/math/e/7/2/e72a9c97103eed0fe72a1975a8fd748a.png[/img] [TEX]sin(x) = x - x^3/3! + x^5/5! - x^7/7!...[/TEX] In C++ terms : [icode] //approximates in 3 expansions float sinus(float x){ return x - (x*x*x)/(3*2*1) + (x*x*x*x*x)/(5*4*3*2*1); } [/icode] Of course you can use a for loop and a factorial function and a power function to expand it more, …

Member Avatar for mrnutty
0
117
Member Avatar for confounded

@FBody: I don't think thats the problem, because he uses end just like you did in your for loop, for comparisons. And in the line he was pointing to, it definitely shouldn't have a bad pointer exception, if his code were working. @OP: Can you show us that HList is? …

Member Avatar for confounded
0
189
Member Avatar for spoinkgeek

Create a class to hold data's: [code] class PersonInfo { private: std::string name; std::string nationality; char gender; // and so on public: //some methods to get datas , set datas and any other function //that you think will be sufficient to this class usually goes here. }; [/code] Now create …

Member Avatar for Amanuel Negash
-1
121
Member Avatar for alwaysLearning0

Couple of ways, one way is to do the following : [code] //interface struct Conditional{ virtual bool preCondition()const=0; virtual bool postCondition()const=0; }; //adapter for default struct ConditionalTrueAdapter: Conditional{ bool preCondition()const{return true;} bool postCondition()const{return true;} }; //interface struct Command{ virtual void execute()=0; }; class PauseGameCommand : public Command{ private: Conditional condition; …

Member Avatar for mike_2000_17
0
185
Member Avatar for bleedi

Post the ascii art one more time, but this time wrap it under code tags. It looks like your binary search tree does not satisfy the property that all left subtree are smaller than the parent, and all right subtree are greater than the parent.

Member Avatar for Momerath
0
173
Member Avatar for qinise4

A popular way to handle large matrix is to divide the matrix into multiple chunks and work that way. Try to see if thats possible. Or post the actual problem here and surely someone can help you figure out a proper solution.

Member Avatar for qinise4
0
2K
Member Avatar for ace8957

try putting [icode]void stringcomp(string str);[/icode] right before "int main()". Also I hope you got a "stringrec.h" that has the prototype of the functions defined in "stringrec.cpp"

Member Avatar for ace8957
0
172
Member Avatar for vbx_wx

Instead of this [icode]float f1,f2,f3,f4;[/icode] use an array like so [icode] float point4[4][/icode]. There are more benefits to use an array than 4 different variables. Plus its easier to maintain.

Member Avatar for mrnutty
0
92
Member Avatar for Bigbrain99

The code [icode] FLATMATE resident; [/icode] creates an instance of FLATMATE. It is called an object. Whenever you create a DUTY object, inside that duty object, is an instance of FLATMATE. So each DUTY object has a FLATMATE object. Its similar to this: [code] class DUTY{ int resident; } [/code] …

Member Avatar for Bigbrain99
0
103
Member Avatar for fidget08

how about you give it a go, and see what happens. Try your best first. Think about this in small steps.

Member Avatar for quila1
0
126
Member Avatar for rpdm

I don't like your consistency with your naming conventions. Don't abbreviate it. Just name your variable something that we all can understand. For example, instead of [i]BST(bull shit tree?)[/i] call it BinarySearchTree. So as to your program, in no particular oder: 1) You need to abstract your program more. Define …

Member Avatar for alwaysLearning0
-1
112

The End.