2,712 Posted Topics

Member Avatar for LdaXy

You want : [code] template<typename T> bool logicalAnd(T x, T y){ return x == y; } int main(){ int x = 3, y = 5; cout << logicalAnd(x,y) << endl; } [/code] Btw, you probably don't want to use double underscore as an identifier because its reserve

Member Avatar for jaskij
0
302
Member Avatar for Karlwakim

Another way is to use java applets with JNI. You can use JNI to access C++ functions and then you can use java to use applets to embed them on the web.

Member Avatar for Karlwakim
0
121
Member Avatar for Drezta
Member Avatar for srinath1
Member Avatar for Karlwakim

Yes, its called machine code. But you wouldn't want to do that. Google it, if you feel like procastinating for a little bit.

Member Avatar for mrnutty
-1
77
Member Avatar for SoulMazer

Here is what people usually do when creating a bullet class. Because bullets get created and destroyed so fast, and because there are so many of them or can be. You are better of using some raw arrays instead. Put a maximum cap on the number of bullets created. For …

Member Avatar for saravmittar
0
197
Member Avatar for witchDoc

What do you have. If you have an equation for the trajectory, then you can simply use that equation as the position equation for the picture

Member Avatar for mrnutty
0
158
Member Avatar for kukuruku
Member Avatar for mrnutty
0
89
Member Avatar for triumphost
Member Avatar for cl2020

what if your sentence is longer than 29 letters? Thus you need to change "char word[30],rev[30]" to accompany this. That is why you should use std::string. [code] std::string word; std::string reverseWord; cin >> word; //word can be of any length, not like the char word[30] array you declared //now do …

Member Avatar for youjean
0
337
Member Avatar for DonnieT2
Member Avatar for Azmah

No it deactivates it, but if you sign in within 2 weeks it reactivates it for you. If you pass the 2week period then they 'delete' it, but they might have you still on their database who knows. If you want to stop using it for a bit, then tell …

Member Avatar for Coloradojaguar
0
480
Member Avatar for Karkalash

I think you're implementing it wrong. It should be, [code] if(CheckCollision(bPos, b_Width, b_Height, p1Pos, p1_Width, p1_Height)) { Vector norm; norm.myVector.x = 1; norm.myVector.y = 0; // i - (2 * n * dot(i, n)) bPos.myVector.x = bPos.myVector.x - 2 * norm.myVector.x * bPos.DotProduct(norm); bPos.myVector.y = bPos.myVector.y - 2 * norm.myVector.y …

Member Avatar for Karkalash
0
609
Member Avatar for fastali

Why don't you just return std::string instead of char* ? Also you need to null terminate result1.

Member Avatar for fastali
0
144
Member Avatar for phorce

You need to resize the vector to M, then for each element in the vector, you need to resize each element to N, get it?

Member Avatar for VernonDozier
0
2K
Member Avatar for stereomatching

>>But it is always 0 after optimize What does that tell you? That unless your doing this for a legitimate reason, you shouldn't have to worry about it

Member Avatar for mrnutty
0
122
Member Avatar for siabenie

It evaluates to true. Work from inside out. Note 1 = true, 0 = false Initial expression : [icode] (! (1 && !(0 || 1)))[/icode] inner most expression is [icode] (1 && !B) [/icode] where [icode] B = (0 || 1) [/icode] Since 1 = true, !B also needs to …

Member Avatar for siabenie
0
114
Member Avatar for stakeMyHeart

Usually, think of lemma as a fact. Its like a theorem but just not as big fact.

Member Avatar for stakeMyHeart
0
119
Member Avatar for kchyn

Yes, but if you want to do it that way, you need to do manual allocation. [code] void foo(string** strs, int width, int height){ //... } int main(){ int width = 0, height = 0; cin >> height >> width; string **strs = new string*[height]; for(int i = 0; i …

Member Avatar for mrnutty
0
290
Member Avatar for diamondfist
Member Avatar for jryans10

It depends on the definition. The second one might not even be allowed

Member Avatar for Narue
0
146
Member Avatar for lxXTaCoXxl

First register for [URL="https://developer.apple.com/programs/register/"]free[/URL]. Then you can download xcode 3 for free from [URL="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20414"]here[/URL]

Member Avatar for mrnutty
0
125
Member Avatar for diamondfist

What do you mean move circle inside a square? You mean move the circle when a key is pressed? If so then in your display function check if certain key is pressed, if it is, increase xpos

Member Avatar for diamondfist
0
235
Member Avatar for gfp91

To offset sprite you can just add to its position, [icode] ball.x += 10; ball.y += 10; [/icode] Other than that, I'm not sure what you want

Member Avatar for gfp91
0
105
Member Avatar for cool_zephyr

Just from a little googling, here is the code in the OpenGL Red Book. [code] #include <math.h> #define X .525731112119133606 #define Z .850650808352039932 static GLfloat vdata[12][3] = { {-X, 0.0, Z}, {X, 0.0, Z}, {-X, 0.0, -Z}, {X, 0.0, -Z}, {0.0, Z, X}, {0.0, Z, -X}, {0.0, -Z, X}, {0.0, …

Member Avatar for cool_zephyr
0
1K
Member Avatar for Despairy

It depends on the size of each cell in the graph. For example, if graph[0][0] is a rectangle of size 1 unit, then when the user presses right, you can move the sprite one unit to the right, and it would now be in graph[0][1]. And similary, if the user …

Member Avatar for Despairy
0
527
Member Avatar for jot121

[CODE]public static int[] GreaterThanFive(int[] values) { int counter = 0; int[] vals = new int[values.length]; for(counter = 0; counter < values.length; counter++) { if(values[counter] > 5) { vals[counter] = values[counter]; } } return vals; }[/CODE] Isn't correct. You need something like this : [code] public static int[] GreaterThanFive(int[] values) { …

Member Avatar for stultuske
0
185
Member Avatar for Ancient Dragon

Happy new year AD! For the first time, I went to see the "ball drop" in New York Times Square. It was harsh 7 hour stand but it was definitely worth it!

Member Avatar for The Dude
4
180
Member Avatar for reallyslick

I see what you want. You want the list to be able to point to a list as well a leaf element. We'll what you want now is a tree, or more general a graph. Google it up. But buy your definition, a regular linked list is already a match. …

Member Avatar for reallyslick
0
144
Member Avatar for oldezwe

The only part you seem to need help on is how to properly "increase in the potential for them to receive a high five from others ". The other problem is fairly trivial. To increase a user's potential of receiving a high-five you first have to note that to increase …

Member Avatar for Philippe.Lahaie
0
158
Member Avatar for mrnutty

[URL="http://stackoverflow.com/questions/194812/list-of-freely-available-programming-books/"]List of free programming books[/URL]. Enjoy and happy new year!

Member Avatar for YAMNA MIDHAT
4
135
Member Avatar for lolwaht

structs are there in C++ for backwards compatibility. Enums are there to help you with constants and a new( but rather old) technique to help in metaprogramming. But lets go back to the constants thing. Which would you prefer? [code] struct{ enum Direction{ EAST, SOUTH, WEST, NORTH } //... }; …

Member Avatar for mrnutty
0
97
Member Avatar for Karlwakim
Member Avatar for daviddoria

You can implement a PatchCollection::iterator and have PatchCollection provide a begin and end function. This would be a good solution because it also makes your collection reusable to STL. Or you can simply have PatchCollection implement begin(), end(), and getNextItem() function, but this adds more coupling to the class, which …

Member Avatar for ravenous
0
135
Member Avatar for DalekThay

Each point on the circumference is defined by[icode] ( cos(x) , sin(x) ) 0<= x <= 2*pi[/icode] All other circle are a variation of that. Since your circle is of radius r, every point on the circumference of you circle can be represented by the above equation with just a …

Member Avatar for WaltP
0
181
Member Avatar for mrnobody

Unless square is modifying a global variable, you don't really have to worry about such issues. But as a general answer, you can use [URL="https://en.wikipedia.org/wiki/Lock_(computer_science)"]locks[/URL] to ensure that only one thread executes a function at a time.

Member Avatar for rubberman
0
143
Member Avatar for PeTo.

If its only 4 randomly generated numbers you need, then you can simply call rand() 4 times. It definitely should repeat just after 4 calls. Make sure you are using it correctly. [code] #include <iostream> #include <ctime> using namespace std; int main(){ srand( time(0) ); for(int i = 0; i …

Member Avatar for adityatandon
0
2K
Member Avatar for Sadun89
Member Avatar for MooGeek

Nowadays, you don't really need the heavy mathematics as someone probably already wrote a library for that. Its more about problem solving and logic skills

Member Avatar for vegaseat
0
163
Member Avatar for Chuckleluck

Try this. 1) Close Visual studio. 2) Right click the visual studio desktop icon 3) Select 'run as administrator' 4) Then try to re-run the program

Member Avatar for Chuckleluck
0
490
Member Avatar for Clinton Portis
Re: :)

[code] #include <iostream> #include <iomanip> #include <string> #include <sstream> using namespace std; int main(){ cout << " ___\n /` `'.\n / _..---;\n | /__..._/ .--.-.\n |.' e e | ___\\_|/____\n (_)'--.o.--| | | |\n .-( `-' = `-|____| |____|\n / ( |____ ____|\n | ( |_ | | __|\n | …

Member Avatar for mrnutty
3
116
Member Avatar for kbar1
Member Avatar for mike_2000_17
0
161
Member Avatar for alex905

You can use a try/catch block in the initializer list. Check out [URL="http://www.gotw.ca/gotw/066.htm"]this[/URL] site. [URL="http://codepad.org/JsOdJUvE"]Here[/URL] is the live code as an example. [code] #include <iostream> struct BadObject{ BadObject() {} BadObject(int i){ throw("Why you no work 0_o?"); } }; struct GoodObject { BadObject b; GoodObject(int i) try : b( BadObject(i) ) …

Member Avatar for mrnutty
0
247
Member Avatar for mrnutty

It is sad to say that Christopher Hitchens died yesterday, failing the battle against cancer. He was a great author and even better person. It is because of him, I learned the many arguments against religion. He will be missed. My sincere condolence goes out to him. May he rest …

Member Avatar for mrnutty
0
113
Member Avatar for jeffpro

Its the same as checking for a point in a 2D rectangle. But depending on the view of the person, you need to determine which face of the cube to check on.

Member Avatar for mrnutty
0
110
Member Avatar for Tigerwatch

>>, BSP trees are still probably the easiest efficient solution; Actually, for simple application, BSP isn't even necessary, simple collision check can suffice

Member Avatar for Tigerwatch
0
162
Member Avatar for jaai

"Give a man a fish, you feed him for a day. Teach a man how to fish and you feed him for lifetime" My son, I will teach you how to [URL="https://www.google.com/search?sourceid=chrome&ie=UTF-8&q=draw+a+line+using+opengl+es2.0#sclient=psy-ab&hl=en&source=hp&q=how+to+draw+a+line+in+opengl+es2.0&pbx=1&oq=how+to+draw+a+line+in+opengl+es2.0&aq=f&aqi=&aql=&gs_sm=e&gs_upl=5458l11650l0l11850l38l23l1l0l0l17l572l5109l0.12.5.2.2.1l23l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=bcd02df78553758e&biw=1276&bih=683"]fish[/URL]

Member Avatar for jerl
0
151
Member Avatar for FiToKa

First this input : [code] // inserting elements for (int i = 1; i <= 10; i++) { exampleTree.insert(i); } [/code] is the worst case scenario for a binary search tree, it will be equivalent to a linked list. So perhaps you should try some predetermined values so you know …

Member Avatar for FiToKa
0
274
Member Avatar for NoUserNameHere

Firstly, the picture doesn't show the connectiveness of the nodes, that is it doesn't show if the node are connected or not, so what are the assumptions? Assuming: 1) intNode->next points to newNode 2) intNode->prev points to null 3) newNode->prev points to intNode 4) newNode->next points to null Now if …

Member Avatar for mike_2000_17
0
146
Member Avatar for alex905

There is probably a lot of way doing this, but here is one way. [code] float scale(float n, float min, float max){ return min + fmod(n,max); } [/code] EDIT: might not be a good scale, although would be correctly, is not a good distribution. Ignore it.

Member Avatar for mrnutty
0
172

The End.