1,426 Posted Topics
Re: Is the error reffering to line 85 in shoes.cpp? I am not seeing anything wrong with the code. | |
Re: @ vmanes Shouldnt line 10 of your snippet be dest[index] = '\0'; // null terminate the destination string | |
Re: I am running Windows 7 and if I need another OS I use VMWare player to run the different OS. Once it is running I normally RDP into it for a cleaner look and feel | |
Re: This const Vector& operator=(const Vector &rhs); Should be const Vector<T>& operator=(const Vector<T> &rhs); And then in you implementation this Vector<T>:: const operator=(const Vector &rhs) should be const Vector<T>&::operator=(const Vector<T> &rhs) | |
Re: You can use malloc on an array that is in the stack. | |
Re: You have not overloaded the `=` operator. You need to do that as well when working with pointers. you should implement it like your copy constructor. What compiler/IDE are you using? I ask because the headers you have are not correct. Also have you thought about using the string class … | |
Re: So what have you done? If this is the code the teacher gave have you modified it at all? Also please repost it so it is not all on 2 lines. I am not sure if anyone is going to be willing to help you without properly formated code. | |
Re: correct me if I am wrong and since I dont have my compiler in front of me I might be. If you have `c = a * b`, then can't you just do a check after the mulitplication for `c / a == b`? If `c` overflows it should break. … | |
Re: @ luicaci Andrew to make your isPrime function a little faster you can do this bool isPrime(int nr) { if (nr == 0 || nr == 1) return false; if (nr % 2 == 0 && nr != 2) // check to see if its even return false for (int … | |
Re: >For this assignment your are to write a program, using strings (from the string class) that plays the popular game of Hangman. Well you might want to switch over all of your char arrays to string like the instructions tell you to use. Might make the rest of the code … | |
Re: Give [this](http://www.cplusplus.com/reference/string/string/) link a try to see what a string can do. >The string object even gives you a function enabling you to pretend it is just an array of char, in case you're stuck with a function that wants an array of char instead of a proper string object. … | |
Re: you might want to look into the [Sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) | |
Re: What seams to be the problem? if you need to know how to calculate the area of a trapezoid look at [this](http://en.wikipedia.org/wiki/Trapezoid). | |
Re: Do you have the == operator overloaded for the `extPersonType`? Remove needs to have that defined in order for it to work. | |
Re: Can you post the code that is causing this order? | |
Re: I think he copied the return statement and forgot to remove the semicolon after changing it to an if. Not sure why he would do that but hey. | |
Re: @ Suzie999 the OP also said this >However one of the functions doesn't have a length passed with the other parameters! >char arrayX(char a[], char v) >Where you are asked to find amount of times value (v) is in the array. He is trying to write a function to deal … | |
Re: Are you trying to run the exe file and getting this error? You might need to have the dll in the folder the exe file is in. | |
Re: Hate to but in but to answer your question Suzie999 your first post neglected the fact that mapReader is a stream object and he is trying to put information from the stream into an uninitialized pointer array. Your second post wouldn’t work either since he is trying to read in … | |
Re: After reading that wiki link you provided I am not a big fan. In order for it to work the person using it will need to know the internals of the class to know what to pass. To me this harms encapsulation. I dont think I'll be using it unless … | |
Re: As far as i know there isnt a backup of the file. You might be able to get away with restoring the file windows if you have Shadow copy turned on? What OS are you using? | |
Re: To display it should look like this std::map<std::string, double> milesto; // load milesto for(std::map<std::string, double>::iterator itr = milesto.begin(); itr != milesto.end(); ++itr) { std::cout << itr->first << "\t" << itr->second << std::endl; } Also notice how I used `++itr` instead of `itr++`. Using the preincrement operator will make the code … | |
Re: line 9 should be std::cout << "You entered" << date; You only need to call cout once. | |
Re: Could you get away by just having a stringstream object in your tokenizer class? What other functionality does PushbackReader offer? | |
Re: main.cpp:6:19: conio.h: No such file or directory ----You dont have conio.h on you computer. main.cpp: In function int main()': main.cpp:54: error:m' undeclared (first use this function) ----What is m on line 54? main.cpp:54: error: (Each undeclared identifier is reported only once for each function it appears in.) main.cpp:55: error: expected … | |
Re: This is already in c++. What do you want to convert it to? There are a couple errors in this. Line 2 and line 70 are wrong. | |
Re: In return (key < str.key); `key` belongs to the object being used and `str.key` is from the object passed to the function. You could also write it like this if it makes more sense to you: return (this->key < str.key); | |
Re: `returnListOfAddresses()` should look like this: for(int t=0; t<(int)addressBook.size(); t++) { cout<<addressBook[t]->toString(); } | |
Re: In your second if statement you are saying [icode] if (num < die) [/icode]. what would happen if I guessed 5 and the die was 2? A better way would be to do [icode] if (num != die) [/icode]. | |
Re: You are still calling main in your if statements to get back to the top of your code. This should NEVER be done. Main is to be called by the OS not the program. You need to rethink your approach so you dont have to call main to get back … | |
![]() | Re: Okay. So what do you have so far? ![]() |
Re: The string type is not a built in type. Strings are objects made from a class. The only native type that can hold a string is a char array. The standard for c++ says that main must look like one of these three options. int main(); int main(int argc, char … | |
Re: It is a shame schools are teaching with 20 year old compilers. | |
Re: can you post the code that works and the code that doesnt? | |
Re: I could be mistaken but if you have a quad core processor you should be able to run 4 threads at the same time. With the way you have your code written right now you start all 100 threads and then right after that you call each thread and wait … | |
Re: int arr[] = {1,2,3,4,5,6,7,8,9}; // array of numbers list numberList(arr, arr + sizeof(arr) / sizeof(int)) load array into list with constructor | |
| |
Re: What is the hangup? Change line 17 to `std::multimap<std::string, PoiDetails> vName;` and change line 34 to `std::multimap<std::string, PoiDetails>::iterator it;`. That should be all you need to do. | |
Re: Since the set holds a vector you need to add a second for loop inside your first for loop. In this second loop you need to print out each element of the vector since the vector does not overload the << operator. | |
| |
Re: On line 38 you have x= pow(cos(lat2)*sin(longz),2.0) + pow((cos(lat1)*sin(lat2))/*<--no exponent*/ - sin(lat1)*cos(lat2)*cos(longz),2.0); The second pow function has no exponent. | |
Re: I had thought to tell him that but the problem states to print the numbers in the order they appear. If his compiler supports c++11 he could use an unordered map and use the value for the key. | |
Re: you need to make sure you are in the bounds of the array before you call `getOrganism()`. You could also add some coe to you `getOrganism()` function and have it check to see if the posistion asked for is within the array. If it is not then it should return … | |
Re: All mergre sorts I have seen that deal with recusrion use the split in the middle method. Is this a recursive merge sort or are the doing an iterative merge sort? | |
Re: What do you have so far? We do not give out the answers to homework problems. You need to show effort before we help. |
The End.