419 Posted Topics

Member Avatar for writerervin

[QUOTE]void sethpmax(){hpmax = lvlhp[lvl - 1];}; void setexpmax(){expmax = lvlexp[lvl - 1];}; Random arrays assigned to int? This should not even compile. [/QUOTE] This looks fine to me. Hes assigning the units health to whatever is at lvlhp[lvl-1] is. So if the guy is level 5 it would be lvlhp[5-1] …

Member Avatar for writerervin
0
468
Member Avatar for lgonzo

Put one do()while() within the other do()while() so it keeps looping unless you are done your game loop and when you do not want to play again. Doing this you will want to have two variables instead of having both as done.

Member Avatar for lgonzo
0
89
Member Avatar for MaDo4

It will only output the last letter because a char type is only one character. You can use a string and add the letters onto that then output the word with outFile.

Member Avatar for MaDo4
0
182
Member Avatar for kra9853
Member Avatar for kra9853
0
584
Member Avatar for tlwtheq
Member Avatar for VernonDozier
0
124
Member Avatar for tudorH

Put a condition in where it will only output if it is not the last element or break outta the loop if it is on the last element instead of displaying a comma. [CODE]#include <iostream> using namespace std; int main() { int myArray[] = {1,2,3,4,5,6,7}; int szArray = sizeof(myArray)/sizeof(int); cout …

Member Avatar for ravenous
0
94
Member Avatar for Shadbanks001

That looks like you copy pasted it off someone elses post because of all the # sitting between the lines.

Member Avatar for sfuo
-2
396
Member Avatar for eduard77

You could just create an int called sum with an initial value of 0 and then make a for() loop just add all the elements to sum one by one until the end of the vector.

Member Avatar for eduard77
0
113
Member Avatar for BlueZephyr

Like 4olkata said use [ICODE]cin >> n1 >> n2 >> n3;[/ICODE] because the comma does not work like that in C++. Also [ICODE]abs(n1)[/ICODE] does nothing because that will just return the absolute value of n1. You want [ICODE]n1 = abs(n1);[/ICODE] because this will assign n1 to the absolute value of …

Member Avatar for BlueZephyr
0
97
Member Avatar for ndowens

First of all you havent declared nSel any where but you are using it, so put [ICODE]int nSel = 0;[/ICODE] before the cout lines or something (just before usage). Then for your while loop you should make it so it loops while nSel is not 1 AND 2 not or. …

Member Avatar for jonsca
0
181
Member Avatar for skips

You can use the % (mod) operator to get the remainder of one number divided by another. ie 72 % 10 = 2 <--- your first digit

Member Avatar for Red Goose
0
131
Member Avatar for lexusdominus

First off I would switch from Dev-C++ because it is a dead IDE. Use Code::Blocks or Visual C++ that is more current (I use Code::Blocks and had switched from Dev-C++ -- the transition wasn't that hard). As for the whole having a window and cmd prompt up at the same …

Member Avatar for lexusdominus
0
211
Member Avatar for wondernaet

I switched made the function return a bool because you are returning false on a void function and ran it and it "broke" and made my motherboard speaker go off like a christmas song for like 3 min.

Member Avatar for sfuo
0
93
Member Avatar for kylej628

Use a do{}while() to loop in main() I would not recommend calling main(). [CODE]int main() { char askLoop; do //do enters the loop weather or not the condition at the bottom is met on the first run { double tax, pay; termlength_determine(); cout << "how much do you get paid …

Member Avatar for sfuo
0
124
Member Avatar for Lemonader

It would take a while to write a program like this without flaws and you would have to think hard but if you look there is a pattern. There are never more than 3 of the same "digits" in a row and its always high digits to low digits, left …

Member Avatar for WaltP
0
1K
Member Avatar for chamnab

Windows uses handles for letting the user/program control elements of the Windows environment (not 100% sure how to explain this). So line 10 is getting the output handle and saving its memory address into the pointer hcon. This is then passed into SetConsoleTextAttribute() on line 11 and has its color …

Member Avatar for sfuo
0
261
Member Avatar for SolidSora

After looking over your code the problem seems to be in main(). You have it so when you input your selection it sets the choice and the space THEN checks to see if the space is 0 or not. This will never be 0 because you are setting it before …

Member Avatar for SolidSora
0
471
Member Avatar for raymondchew2007

[CODE]#include <iostream> using namespace std; int main() { cout << "Hello world!" << endl; return 0; }[/CODE] This is the start of a program now go throw on some ints and add them together. Once that works figure out how to use a container ( list, vector, array... ) and …

Member Avatar for kernel>panic
0
133
Member Avatar for dadam88

Not 100% sure why you are using an array to store your character since you are only using 1. Also when you make an array [ICODE]char answer[1];[/ICODE] that means that it has a size of 1 and it starts at 0 so you would use it like [ICODE]if( answer[0] == …

Member Avatar for frogboy77
0
437
Member Avatar for Nahdir

Personally I would start with just using a single variable instead of trying to make a list work because that just adds more complexity to something that you are trying to figure out. And if you are going to then just use the std namespace to shorten and clean the …

Member Avatar for Nahdir
0
94
Member Avatar for skorm909

Your expe keeps building because you keep adding itself with the new random exp to itself. If you want to just add the amount of exp for killing that goblin then you need to just assign the random exp gained to expe (like you did for loot). In other words …

Member Avatar for sfuo
0
226
Member Avatar for crimes

This example uses a do while loop to keep asking for the user input if it is not correct. A do while loop will enter the loop no matter what the value of the variable that you are checking against is but will check at the end. In this case …

Member Avatar for crimes
0
148
Member Avatar for arsnic

Way too much to see whats going on and the line numbers are off with your errors. Try to create a small program that uses your polygon class in a similar way to see whats going on with it. Plus this is C++ why not use a vector (or another …

Member Avatar for arsnic
0
585
Member Avatar for geryin
Member Avatar for Ancient Dragon
0
146
Member Avatar for Seapoe

In the <ctime> header there is a function called clock() and it tells you in miliseconds the amount of time passed since the start of the program. If you are testing one algorithm this will mostlikly give a value of 1 or 0. A way around this is to run …

Member Avatar for UberJoker
0
3K
Member Avatar for vanalex

This is an example using string stream and c++ strings using a similar format to what you posted above. [CODE]#include <iostream> #include <sstream> using namespace std; class DATE { int day, month, year; public: DATE(); DATE(string d); int GetDay(); int GetMonth(); int GetYear(); }; DATE::DATE( string d ) { stringstream …

Member Avatar for vanalex
0
183
Member Avatar for tKc

You can do 2 things for this. #1 save all the points into a container and plot them each time #2 make the board once outside of the infinite loop and plot the points on within the loop The following code shows #2 because I think it is the best …

Member Avatar for WaltP
0
225
Member Avatar for tmantix

An easy way to think of a string is that its an array of characters in C and a vector of characters in C++. Meaning it can hold any character. If you want something like " ' or \ in it you need to put an escape character before it …

Member Avatar for tmantix
0
237
Member Avatar for andimiami

I fixed it up so it actually runs but I removed the whole height_in_feet variable because it was not being used. Since there are so many errors I would suggest you relearn the basics of functions. Check this against yours and see where you went wrong. [CODE]#include <iostream> using namespace …

Member Avatar for sfuo
0
174
Member Avatar for Behumat

The problem that really stands out for me is your output area. You are using [ICODE]cout << "text" << +a;[/ICODE] and [ICODE]cout << "text" << +a+ "moretext" << +b << endl;[/ICODE] When using cout only use + for adding numbers together. For output you just need to go [ICODE]cout << …

Member Avatar for Kremlan
0
159
Member Avatar for frogboy77

Try this [CODE]slong** newarray = 0; for( int i = 0; i < limitsqr; i++ ) newarray[i] = new slong[limit];[/CODE]

Member Avatar for frogboy77
0
123
Member Avatar for kuchick32

Made a few changes to it and it works fine. Read the comments. [CODE]#include <iostream> #include <string> //use string not cstring using namespace std; //move using namespace std; up here int main() { string str2; cout<<"Enter a line of input for str2: "; getline (cin, str2); //remove cin >> str2; …

Member Avatar for kuchick32
0
112
Member Avatar for tln26
Member Avatar for aviavyne
Member Avatar for spirit of love
0
1K
Member Avatar for aviles

The way you are doing it says int/int*(int*int)+int you want everything multiplied to be a float otherwise it converts it to an int. 1/2 gives the answer 0 because integers do not have decimals. 1.0/2.0 gives the answer 0.5 because doubles/floats do have decimals. So the way to write what …

Member Avatar for sfuo
0
180
Member Avatar for keweul

You need to add a break after case 1 because it just runs into case 2 which makes it output "twenty" Here is another way to do this with strings and arrays. [CODE]using std::string; int numToText(int num) //function to return text version of number entered { string ones[] = { …

Member Avatar for keweul
0
239
Member Avatar for cortez716

Not sure why you are making it so complicated and you are using a int function when the way you have it you could use a void function. [CODE]int SumIt(int x, int y) { if( x == y ) return x; int high = x, low = x, sum = …

Member Avatar for cortez716
0
186
Member Avatar for 4221dave

A .dll file is a dynamic linker file which has to be included with the .exe if you do not use the static linker file. If you add the .a or .lib file (static linker) then you do not need the .dll file but the size of the .exe will …

Member Avatar for sfuo
0
122
Member Avatar for aaronmk2

I'm not sure what coefs is an array of (I'm guessing ints) but the pow() function returns a double so you would run into more casting problems there. I would just use the c-style casting for this problem unless you need to use C++ style type-casting. [CODE]sum += coefs[i]*(int)pow((double)x, (double)degree);[/CODE]

Member Avatar for sfuo
0
97
Member Avatar for daniel955

Could have something to do with depth. Lets see some source code and then I'll be able to help you out more.

Member Avatar for daniel955
0
154
Member Avatar for Peter_morley

I see other people have posted already but I am going to show what I did as well. In the code I just put the Date class and anything to do with Date in because the Actor class was not fully shown in the code you posted. I cleaned it …

Member Avatar for Peter_morley
0
455
Member Avatar for LevyDee

Those are defined in the windows.h header and they are set that way for consistency since every data-type they have defined is in all capitals. They have other ones like BYTE for char and a whole bunch more. Just look up windows typedefs and you should find lots.

Member Avatar for mrnutty
0
89
Member Avatar for Gekitatsu

I looked through your code and you should not use perspective when you are trying to render something that is 2D. So use glOrtho() this way everything is flat (no depth). In your render() and initialize() functions remove gluLookAt(); And use this code for your SetupProject() function [CODE]void SetupProjection() { …

Member Avatar for Gekitatsu
0
140
Member Avatar for NV43

As visitor11 said you need to put the variable to be assigned on the left hand side of the equals sign otherwise it will try to assign number%10 and it cannot do that. C++ uses operators to do multiplication division addition subtraction and it does not use brackets for multiplication. …

Member Avatar for NV43
0
108
Member Avatar for ticktock

If you aren't using the animate function right now comment it out or make the function and just don't have anything in it (currently you have the prototype but no real definition and that is what is giving the error). Also when I read through your code your stick man …

Member Avatar for ticktock
0
108
Member Avatar for kuen

You need to start with a simple program to understand what is going on because some of the questions you are asking are extremely basic where if you had looked at other examples (easier) you would know generally what is going on with it. '1' = player 1 '2' = …

Member Avatar for kuen
-1
154
Member Avatar for XodoX

You should really format your code so other people can read it. I commented in a few things that I did and do not put function prototypes within other functions. [CODE]#include <iostream> #include <fstream> #include <string> #include <iostream> #include <string> #include <cctype> // for std::isspace(), etc. void print_tokens(const std::string &data); …

Member Avatar for XodoX
0
92
Member Avatar for PixelExchange

You can create a window without buttons or a boarder and create your own buttons using the mac images and then bind windows functions to them.

Member Avatar for PixelExchange
0
96
Member Avatar for Ee Juan

You have your for loops all messed up so it is outputting sections more than once in a row. [CODE]#include <iostream> using namespace std; int main() { int num = 0; cout << "How big do you want the pyramid? "; cin >> num; for( int i = 0; i …

Member Avatar for mrnutty
0
102
Member Avatar for hystaspes

I bought the red book and blue book and I did get the OpenGL tutorials off gametutorials.com I would say they are good for learning a bit of stuff but not worth 35 bucks (35 for just OpenGL and DirectX tutorials). NeHe's website is really bad and I would suggest …

Member Avatar for hystaspes
0
136

The End.