2,712 Posted Topics

Member Avatar for spiriad

Yep If I am reading correctly, then you need to check the collision between objects in your room, so they "interact" with each other.

Member Avatar for spiriad
0
116
Member Avatar for mybluehair
Member Avatar for Chillawowa
Member Avatar for StaticX

>>Does that initialize all of the elements to zero? I guess so. I haven't seen that before either.

Member Avatar for VernonDozier
2
127
Member Avatar for DawnOfIkaros

read [URL="http://www.cplusplus.com/doc/tutorial/files/"] this[/URL]

Member Avatar for DawnOfIkaros
0
101
Member Avatar for mrPaul

replace the && with the ||. You wan't the loop to run if either currentX OR currentY is not equal to toX or toY, respectively. Also take out the else { currentX-- } and else{ currentY-- } there is not point since say currentX will not increment if its 100.

Member Avatar for mrPaul
2
108
Member Avatar for Mafia619

1) First create a prime number generator 2) The adjust it accodignly to what you need it. A prime number is one where its 2>= | n | < MAX, n != even, n is evenly divisible its self and 1 only. A few primes are 2,3,5,7,11. 5 is a …

Member Avatar for VernonDozier
0
313
Member Avatar for caperjack
Member Avatar for caperjack
0
155
Member Avatar for nunchuckie

Make use of function. 1) Create a function that does this f(34)=17 , for a given value. Make sure it works. For use a for loop with from start to finish and just call that function. It will be more readable, better code/practice and you will get a better grade.

Member Avatar for mrnutty
0
153
Member Avatar for Ahmad Shaheen

I feel nice today so I will help you : Define a Double Linked Lists EmpRank where the data should be of type integer. [code] #include<iostream > using namespace std; int main(){ cout<<"Here is a double linked list called EmpRank"; cout<<" that I got from daniweb forumn, Please give me …

Member Avatar for Clinton Portis
-1
151
Member Avatar for pspwxp fan

This gets rid of the error in visual studio 2008, but it doesn't mean your program works. Try it : [code] #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { vector<string> gameName; int choice = 0; string game = " "; vector<string>::iterator myIterator; vector<string>::const_iterator iter; …

Member Avatar for pspwxp fan
0
113
Member Avatar for kiryoku

Break the pattern down. Linearly : some numbers | middle number| some number reversed [code] 1 2 |3| 2 3 4 |5| 4 3 4 5 6 |7| 6 5 4 5 6 7 8 |9| 8 7 6 5 6 7 8 9 0 |1| 0 9 8 7 …

Member Avatar for ScottieF
0
289
Member Avatar for maverick405

Most likely its raw definition will be something like this : [code] void swap(char& a, char& b) { char temp = a; a = b; b = temp; } [/code] Think of whats happening.

Member Avatar for mrnutty
0
77
Member Avatar for rafta

In bubble sort when every you swap print out the array. In selection sort, whenever you swap print out the array. Also your functions : showArray1 and showArray2 is repetitive to each other. You only need one of them, and pass array1 or array2 whenever you wan't to print them …

Member Avatar for rafta
0
269
Member Avatar for maverick405

If this is what you are looking for : [code] enter a word : hello hello backwords is : olleh [/code] then all you have to do is use a for loop, start from strlen(str)-1 , to >= 0 and print out at index i.

Member Avatar for Narue
0
82
Member Avatar for nick30266
Member Avatar for dharm_naresh

It is converting it correctly. It just doesn't display the trailing 0's. If you want to see the trailing 0's then you can use [URL="http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html"]DecimalFormat[/URL]

Member Avatar for mrnutty
0
110
Member Avatar for maverick405

Just create some functions, for example a function for addition would look like this : [code] int addNumbers(int number1, int number2){ return number1 + number2; } [/code] And you can do similar for other operation. It might seem like its not worth it but doing this will make your program …

Member Avatar for mrnutty
1
121
Member Avatar for unsure

How to use functions : 1) Declare a prototype . Ex : [code] //int is the return type //calculateBonus is the function's name //int number is its argument // the semicolon " ; " means its a prototype int calculateBonus(int number); [/code] 2) Give it a body outside of main …

Member Avatar for Nick Evan
0
141
Member Avatar for iammfa

How are you getting the sprite to be displayed, meaning what graphics library are you using?

Member Avatar for mrnutty
0
273
Member Avatar for mrnutty

[B]If yu wer strnded in a is_land ten wat wud u brin , u gt at mst fiv tings and no triky buzzness, understand?[/B] I would bring (1)Angelina Jolie, then my (2)laptop (with infinite battery life, that catches wifi from earth to outerspace), a (3)knife, an a (4)manual on how …

Member Avatar for Grn Xtrm
-2
127
Member Avatar for nu2cpp

[QUOTE=nu2cpp;1050330]Hi Guys, I am trying to reverse engineer some of the openGl function into pure c++ and need some help. I can't use openGL but need to do some of the stuff it does. I am trying to figure out how to code glViewPort(...) in c++. Any help in this …

Member Avatar for play_c
0
162
Member Avatar for restrictment

Good. Now try to be more organized and start learning classes. Once you have a "good" grasp, convert the code into objects.

Member Avatar for restrictment
1
360
Member Avatar for Alinthea

[QUOTE=mohammad nour;1050577]I wont it like that [CODE]* * * * * * * * * * * *[/CODE][/QUOTE] By looking at the figure,what can you tell me about the; line by line?

Member Avatar for mrnutty
0
89
Member Avatar for StaticX

>>void class::getNumberOfoBJECTS(HOW DO I PASS FILENAME HERE?) << I guess you were not listening. [code] void class::getNumberOfoBJECTS(string fileName) { fstream* file = new fstream(fileName.c_str(), fstream::in | fstream::binary); [/code]

Member Avatar for Ancient Dragon
0
90
Member Avatar for kent01981

There are many ways, I will show you one way : [code] #include <iostream> #include <sstream> #include <string> using namespace std; void extractWords(string source, string * wordArray, const int size) { stringstream seperate; //our stream object that will extract each word seperate << source; //insert what we want to extract …

Member Avatar for jbennet
0
3K
Member Avatar for aman rathi

If practice is what you want then [URL="http://hkn.eecs.berkeley.edu/~dyoo/cs3/recursion-problems.pdf"]google1[/URL] [URL="http://hkn.eecs.berkeley.edu/~dyoo/cs3/recursion-problems-2.pdf"]google2[/URL]

Member Avatar for Cmad
0
119
Member Avatar for farhan0795

Take it step by step. create this part first : [code] Enter values in first array: a h b c u v I j k e Enter values in Second array: y u d f g k I w q a [/code] Then create this part : [code] Merged array: …

Member Avatar for mrnutty
0
126
Member Avatar for kenny1989

Clock() is not "that" accurate but it should be accurate enough, unless you need more accuracy. Try it out first and then decide. [code] #include<ctime> #include<iostream> using namespace std; int main() { long clk_strt = clock(); // some code goes here to test long clk_end = clock(); cout<<"Difference in milliseconds …

Member Avatar for VernonDozier
1
188
Member Avatar for userits
Member Avatar for squigworm
Member Avatar for hussamo

[QUOTE=pecet;1048509]I have a question. Lines #21, #22 and #23: [CODE] employee *first=NULL; first=new employee; if(first==NULL){ //... [/CODE] If you allocate memory for pointer 'first', is that possible for 'first' to be NULL unless you get some exception?[/QUOTE] Yes, but what he is doing is wrong. If you use nothrow when …

Member Avatar for mrnutty
1
72
Member Avatar for infern0

just a simple if statement will do before the calculation. [code] if input is -1 then return 0 else carry on with the calculation. [/code]

Member Avatar for pecet
0
118
Member Avatar for EngneerNitemare

This one is pretty simple : [code] void bubbleSort(vector<int>& vec, bool sortAccendingOrder = true){ for(int i = 0; i < vec.size();i++) for(int j = i+1; j < vec.size(); j++) { if(sortAccendingOrder) { if(vec[i] > vec[j]) std::swap(vec[i],vec[j]); } else if(vec[i] < vec[j]) //else decendingOrder std::swap(vec[i],vec[j]); } } [/code]

Member Avatar for mrnutty
0
2K
Member Avatar for maverick405

For your cube array do your calculation like this : [code] for(int i = 0; i < Size; i++){ values[i] = values[i] * sqrt( float(values[i]) ); } [/code] That way you multiply your square number by its root, which is the original number you inputed.

Member Avatar for mrnutty
0
141
Member Avatar for bpt0004
Member Avatar for donaldw
0
138
Member Avatar for Joebrauk

You have : 1 2 3 2 3 1 3 1 2 Think of it as a variable : a b c b c a c a b 1) you can see that they are rotated to the left. a b c //original b c a //rotated to the left …

Member Avatar for mrnutty
0
76
Member Avatar for maverick405

You have this : [code] return 0; system("PAUSE"); return EXIT_SUCCESS; [/code] Take out the return 0 , since return EXIT_SUCCESS is the same thing. So you should now have this : [code] system("PAUSE"); return EXIT_SUCCESS; [/code]

Member Avatar for maverick405
0
100
Member Avatar for ammadkhan
Member Avatar for ammadkhan
0
141
Member Avatar for jennwenn25

Do you understand this ? [CODE] if( something) { do something } else if( it is something else ) { then do something else } else if( it is something else) { then do something else }[/CODE]

Member Avatar for mikiurban
0
118
Member Avatar for voxis
Member Avatar for kommuru
0
796
Member Avatar for richman0829
Member Avatar for mrnutty

The function adds two large numeric string together, like "12345667" + "12345678" = ? It does not have complete error checking, I'll leave that up to you. It should work but I am prone to bugs, so do advise if bugs are found. Included are also helper function that helps …

Member Avatar for mrnutty
4
618
Member Avatar for squigworm

try char * retail. But you will have to allocate memory before the use of it. BTW why do you need it to be global?

Member Avatar for squigworm
0
138
Member Avatar for Jannelle5

in your reverse function, what happens if num is less than 0? What would the function return? Get the input as a string and print the string backwards. Makes sure the string contains numeric data if you want.

Member Avatar for jbennet
0
347
Member Avatar for tkud
Member Avatar for mrnutty
1
82
Member Avatar for godsgift2dagame

Have a test condition in your for loop. In psuedocode : [code] for i = 0 untill MAX{ pick1 = random number pick2 = random number while(pick2 == pick1 ) pick2 = another random number pick3 = random number while(pick3 == pick2 or pick3 == pick1) pick3 = another random …

Member Avatar for godsgift2dagame
0
102
Member Avatar for richman0829

They have given you the answer, but let me expand on that : Your prototype for fillArray is this : [code]int fillArray(int);//Trying to make a fn that fills an array[/code] What does that mean ? It says that fillArray takes an int variable and returns an int variable. What you …

Member Avatar for richman0829
0
153
Member Avatar for The Dude
Member Avatar for cwarn23
1
97
Member Avatar for jonathanYoung

ouch that hurts my eyes. WHY aren't you using loops ? [code] do { for(int i = 0; i < 15; i++){ cout<<"|"; for(int j = 0; j < 15; j++){ cout<<intmap[i][j]; } cout<<"|"; } //rest of you code for input }while(true) [/code] Your teacher would fail you if she …

Member Avatar for jonathanYoung
0
109

The End.