No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
26 Posted Topics
You can make a simple function to do this using the properties of logarithms. [CODE] #include <iostream> #include <cmath> #include <string> using namespace std; void IntToString(int i, string & s) { s = ""; if (i == 0) { s = "0"; return; } if (i < 0) { s …
I am not exactly sure what you wish for the program to do, but I am guessing you want it to evaluate statements like 5 + 2 + 8, instead of only 2 operands and an operation for each evaluation. If what I am guessing you want to do is …
This is a game DEVELOPMENT forum, not a discuss how much you like current existing mmorpg forum. Also you revived a thread over 2 months old.
cout << "Enter another name or 1 to quit" << endl; cin >> i ; You are reading into an integer, so you can't expect it to be able to store a name in there. for a solution: read into a string for the name, and if the string length …
It has already been a few days since I signed up here, but Hi! I figured it was about time to post a thread here. Since I guess I am still new: I am a C++ learner at the moment who is wanting to go into the field of game …
this is the type of algorithm you should be using: determine which baloon has the maximum distance from the shooter (distance formula for each balloon then sort into an array if you will) starting with the balloons with the greatest distance from you and ending with the closest baloons. Run …
Brackets must always appear after a function header to signal that a body exists, even if one doesn't! just add {} at the end of the function headers.
Well, just loop through all but the first character, and make sure it is either a digit or a period. if it is neither(even if it is a negative sign), then it is invalid input. what you already have does this [CODE] if (i == 0) { if (((myStr[i] < …
Hi, after searching this forum adequately (I think) I have decided to post this thread asking for an easy to understand resource that describes how to do multithreading on C++ in windows. The current ones I am finding out there on the web either 1. Simply don't work or 2. …
[url]http://www.daniweb.com/forums/announcement8-2.html[/url] Please make an effort to solve the problems yourself, and if you still need help, tell us what specifically you need help with after posting some of your code segments that aren't working.
simply put, cout doesn't know how to print out an interator. also I am confused as to why you are attempting to dereference the iterator when it isn't a pointer. Try converting the iterator to something you know the cout can print.
My suggestion is that you return a reference to a matrix so you can do m1 + m2 + m3 etc etc. Just add a & after mat in the function header. As for your problem. this should be treated as an error whenever it called in my opinion, so …
Be specific about what you need help with, that way we aren't doing your homework for you.
if(input[2] != '/' || input[5] != '/') result = false; checks to make sure there are '/' in the right place, and look at the array that it is being searched through to search indexes for a digit value int numerals[8] = {0, 1, 3, 4, 6, 7, 8, 9) …
system pause seems to be frowned upon anyway, but the best replacement (if you don't care about portability) could just be to use #include <conio.h> // windows only, for getch cout << "Press any key to continue."' getch(); //waits until one key is pressed Sorry I don't know about color …
No, not bright red, bright yellow on a slightly darker yellow background. For your scoring system problem though, I think it work if you made two parallel arrays, one containing scores, the other containing player names. Run a swap or bubble sort (the only two easily implemented sorts I think) …
return cn,ca; You can only return one value at a time, there is a way around this though, it is called passing values by reference. To pass by reference, you simply add & after the data types in the parameter list in both the function header and function prototype. This …
if you want a simple solution, go here and check out operator<< and operator>> the basic idea is to shove into the string stream a stream you read in when asking for a value and to read into a float from the stringstream to have it formatted [url]http://www.cplusplus.com/reference/iostream/stringstream/[/url] if you …
pseudo-code for checking to make sure it is in increasing order: open file for input lastnum = read in a number while (still stuff in file) { input = read in a number if input < last num ___print input " is not in order!" lastnum = input }
I created a snake game using objects of snake segments that act together in a linked list type way (I think.) and I notice that when you select quit after you die with more than 2 links, the program throws some run time error. Even funkier, when I used a …
You have c1.d() and c1.bd() BOTH returning zero. Instead you should return the values you read in, return a; or return b;
Well since you want to do it in a for loop, you must realize that this is probably a job for pointers since you can't make a for loop generate names for your variables to hold the class. What I would do is this: [CODE] int main() { const int …
pseudo-code follows: .... get option while option isn't 1 or 2 display "Bad option selection, re-enter it: " get option end while if option is 1 call func1 with A and B if option is 2 call func2 with C and D
There really is no "best" compiler. But when I was just beginning c++ (I actually started out with basic, then visual basic like you) I found it the easiest to compile in dev-c++. Just make sure you download the one with the mingw compiler. [url]http://www.bloodshed.net/dev/devcpp.html[/url] As soon as you download …
After searching around this forum for a bit, I found getch() in conio.h, this very closely matches the type of function I am looking for, but I don't want it to wait for the user to enter a key (It would be nice if it would just return -1 or …
The End.
Joatmon