2,712 Posted Topics
Re: Whats the problem with loading the bitmap from a file in the same directory? | |
Re: Your question is kind of vague, but possible any one of these : [code] string->size(); //if you are using std::string * strlen(string); //if you are using c-style string [/code] | |
Re: Also note, you might think about using std::stack because of its stack property, when you insert data in it, you will effectively have it in 'reverse'. Example : [code] #include <iostream> #include <stack> template<typename T> class Reverser{ private: typedef std::stack<T> Container; private: Container _cont; public: template<typename Iterator> Reverser(Iterator begin, Iterator … | |
Re: It might be possible but it would be a lot of work, and might not be worth it. Is this just for curiosity or a project or something else? | |
Re: You can add '#' character as a guard or some other character, and have it move for example from a left wall to right wall ![]() | |
Re: Find a hobbie. - Workout - Sports - Poker? - Get a new look - Go hang with friends - masturB**e ![]() | |
Re: First you have to think if your idea is valid? Even though you are modeling the shape in 2D space, the object to be modeled could still be 3D( is it? ). If it is, then you might be better off trying to model it mathematically, rather than importing it … | |
Re: >>Can We find any Number through binary search in 33 size array? As long as the number is in the array and the array is sorted. | |
Re: Check out blender, others are 3DS Max and Maya, here is a list, [URL="http://en.wikipedia.org/wiki/3D_computer_graphics_software"]http://en.wikipedia.org/wiki/3D_computer_graphics_software[/URL] | |
Re: Google cctype library. Here is an example : [code] string n = "1232" bool isNumber = std::count_if( n.begin() , n.end() , isdigit) == n.size(); // check if all element isDigit [/code] The few function you would want to take a look at are [i] isdigit() and isalpha() [/i]. | |
Re: Your terms are way to vague. Judging from your example, you can do something like this : 1) Sort the set 2) Define a MIN_DISTANCE_TO_SPLIT 3) Keep a beging / end pointer, both pointing to the start of the sorted list 4) Move the end pointer until a difference of … | |
Re: As suggested the easiest way to achieve it is using std::string as follows: [code] std::string getClampedInput(const int maxSize){ string str; getline(cin,str); int clampedSize = maxSize > str.size() ? str.size() : maxSize; //make sure maxSize is not greater than input size return str.substr(0,maxSize); } [/code] another way is to do it … | |
Re: you can use std::sort. Here is an example : [code] struct DaniwebMember{ int ranking; int age; DaniwebMember() : ranking() , age() {} DaniwebMember( int r , int a ) : ranking(r) , age(a){} }; bool compareByRanking(const DaniwebMember& m1, const DaniwebMember& m2){ return m1.ranking < m2.ranking; } bool compareByAge(const DaniwebMember& m1, … | |
Re: You need to understand .bmp format first. As always [URL="http://en.wikipedia.org/wiki/BMP_file_format"]Wiki[/URL] has a great article on its format. You need to read in specific things before you read the actual pixel first. If you really just want to learn then you can go read the article and work from there, if … | |
Re: You can do it through a conversion operator : [code] class PositiveInteger{ int i; public: PositiveInteger(int i1 = 0 ) { i = i1 < 0 ? 0 : i1; } operator int(){ return i; } }; int main(){ PositiveInteger i(23); int j = i; //convert to int } [/code] | |
Re: To expand on what has been said you can use break to break out of the loop and continue to skip the current execution for example : [code] for(int i = 0; i < 5; ++i){ if(i == 3) break; } [/code] will break out of the loop that is … | |
Re: U+0020 is the code for whitespace. So you have a whitespace at the end of your sentences in your file. Run through the file and remove any whitespace at the end of the sentence. Alternatively, you can create a trim function that removes whites spaces from the front/end. | |
Re: 1) Replace all instance of 'char' with std::string in your program 2) Don't use 'goto', use conditional loops instead. Imagine there were no 'goto' command, how would you restructure your program accordingly? | |
![]() | Re: >>Is there a way I can find the list of sets of Coordinates on it's parameter? >>The expected out put should be: I still don't know what exactly you mean by that. Can you explain a bit more. |
Re: Casting in that example if fine. But looking at your code, you are probably going to want to encapsulate the member variables, that way operator< does not have to be a friend function. [code] #include <string> #include <iostream> using namespace std; class StrategyKey { public: StrategyKey(){} ~StrategyKey(){} StrategyKey(const char* strA): … | |
Re: >>the program should check if [B]all[/B] even integers from low to high can be written as the sum of two prime numbers So if one test fails in that range then the whole test fails? I'm sure I can prove that given a range of x to y that there … | |
Re: >> while((e!=0) || (i<5)); I think you want to change that to [icode] while((e!=0) && (i<5));[/icode] I would suggest restructuring your program using functions and std::vector | |
Re: It would make more sense if you move it relative. Why would you want to move it absolute? | |
Re: Also check out [URL="http://en.wikipedia.org/wiki/Hidden_Markov_model"]HMM[/URL] | |
Re: Why cant you just center it at position 0? | |
Re: 1) Make sure you spelled it correctly 2) If its on another file, make sure you import it using [i]#include "insertHeaderNameHere.h" 3) Else post your code | |
Re: Can you modify the function so that it needs ints or make it template? | |
Re: Seriously, I don't get what the big deal is? They are just regular people like us, but somehow brainwashed the masses into thinking they are above us. | |
Re: Some hints : [code] const char minLetter = 'A'; const char maxLetter = 'Z'; char randomChar = char( minLetter + rand() % (maxLetter - minLetter + 1));//returns a random character from [minLetter,maxLetter] const int minInt = 0; const int maxInt = 9; int randomDigit = minInt + rand() % (maxInt … | |
Re: >>how to rand between three integer num1 num2 num 3 You say in [B]between[/B] the three integers. That means one of the numbers, either num1, num2 or num3 has to be a min or the max. Which means the last one has to fall in between. Thus this implies that … | |
Re: Need more code. What type of exception? Is region a valid index? | |
Re: Not quite. Assume you have this : [code] int numbers[5] = {1,2,3,4,5}; [/code] and now you want to print all values in the array. Here are some hints. Generally you would want to use a for-loop when you know how many elements you want to iterate over. Google for loops. … | |
Re: put [icode] SDL_Quit(); [/icode] inside your CleanUp() function. | |
Re: Look into [URL="http://openil.sourceforge.net/"]devIL[/URL]. Generally, for these things you would want to use an external library. | |
Re: Whats the point of car? I mean given the material we should be able to create one right? | |
Re: [QUOTE=mike_2000_17;1553531]First of all, [ICODE]if(x==MINVAL)[/ICODE] makes no sense, I think you meant to write [ICODE]if(x < MINVAL)[/ICODE]. Second, I'm pretty certain that you would be better off using a Tailor series expansion. All you should need is a Taylor series expansion around 0 degrees for both the sine and cosine, which … | |
Re: Maybe an example would help : Suppose this is your current polynomial : [tex] 4x^3 + 2x^2 + x + 3 [/tex] and you want to add the term [tex] 5x^2 [/tex]. Then you look at you list of terms, and see if there is a term with an exponent … | |
Re: Just read the definition of Big-Theta and apply from that. That question is basically asking you to know what the definition means. | |
Re: Remember the keyword "constant" multiple. If you put the constant in the exponent, then there would be a exponential difference and not a constant difference. | |
Re: You should be using std::vector and std::string. Thus assuming that, you can do the following : [code] bool found = std::find( vectorOfStrings.begin(),vectorOfString.end(),stringToFind) != vectorOfString.end(); [/code] | |
Re: Try capital 'A' instead of lowercased 'a', in [icode] class Savings : public Account{...}[/icode] | |
Re: prepend void before send(...), thus making send a function, because the compiler is thinking its a constructor of some sort. | |
Re: The above code is garbage and wont work for every compiler. Its trying to point to the address 0xE6EB54. Don't bother wasting your time with these nonsensical code. | |
Re: Rule of thumb: When using pointers, if possible, use the arrow operator (->) When not using pointers, use the dot operator ( . ) | |
Re: You never intialized sec. Anyways, you should be doing something like this : [code] class Vector2F{ private: float pos[2]; public: Vector2F() : pos(){} Vector2F(float x, float y) { pos[0] = x; pos[1] = y; } float getX(){ return pos[0]; } float getY(){ return pox[1]; } void setX(float x){ pos[0] = … | |
Re: make it like so : [code] template<typename T> void Stack<T>::push(const T& val); [/code] notice the constant. | |
Re: Suggestion is to use std::string and std::sort. Its just a few liner : [code] #include <iostream> #include <algorithm> using namespace std; int main(){ std::string input; cin >> input; //get input std::sort(input.begin(),input.end()); //sort it cout << input << endl; //print it //or access each element like so /* for(int i = … | |
Re: You need proper includes. [code] #include <iostream> using namespace std; int main(){ int x = 0; //initialize variables int y = 0; //initialize variables int z = x * y; //calculate z cout << "Z = " << z << endl; //print out the variable 'z' return 0; } [/code] | |
What are your guys opinion about god? Are you guys atheists, theist, or don't care? Can we discuss about god. | |
Re: Just curious why do you want this information? |
The End.