419 Posted Topics

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
127
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
209
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
91
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
122
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
259
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
469
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
132
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
433
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
93
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
223
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
143
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
581
Member Avatar for geryin
Member Avatar for Ancient Dragon
0
144
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
181
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
223
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
235
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
157
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
122
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
109
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
178
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
238
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
182
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
93
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
153

The End.