2,712 Posted Topics

Member Avatar for Veneficus
Member Avatar for mrnutty
0
102
Member Avatar for eman 22

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]

Member Avatar for mrnutty
0
103
Member Avatar for Sonia11

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 …

Member Avatar for mrnutty
0
310
Member Avatar for stereomatching

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?

Member Avatar for thekashyap
0
162
Member Avatar for SQLpower

You can add '#' character as a guard or some other character, and have it move for example from a left wall to right wall

Member Avatar for iamthwee
0
321
Member Avatar for WolfShield

Find a hobbie. - Workout - Sports - Poker? - Get a new look - Go hang with friends - masturB**e

Member Avatar for iamthwee
0
384
Member Avatar for tim8889

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 …

Member Avatar for tim8889
0
193
Member Avatar for kashif inayat

>>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.

Member Avatar for mrnutty
0
60
Member Avatar for Labdabeta

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]

Member Avatar for mrnutty
0
110
Member Avatar for centerline00

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].

Member Avatar for centerline00
0
263
Member Avatar for Jsplinter

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 …

Member Avatar for Jsplinter
0
258
Member Avatar for stupendousomega

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 …

Member Avatar for mrnutty
0
215
Member Avatar for sadsdw

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, …

Member Avatar for sadsdw
0
121
Member Avatar for ilnura

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 …

Member Avatar for ilnura
0
145
Member Avatar for a.muqeet khan

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]

Member Avatar for a.muqeet khan
0
103
Member Avatar for tubby123

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 …

Member Avatar for Arbus
0
193
Member Avatar for dboltz03

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.

Member Avatar for vijayan121
0
2K
Member Avatar for M1n1m@l1$t

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?

Member Avatar for M1n1m@l1$t
0
3K
Member Avatar for andylbh

>>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.

Member Avatar for StuXYZ
0
162
Member Avatar for Jsplinter

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): …

Member Avatar for mrnutty
0
176
Member Avatar for kimkim0513

>>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 …

Member Avatar for TrustyTony
0
251
Member Avatar for daianahoney

>> 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

Member Avatar for daianahoney
0
292
Member Avatar for pseudorandom21

It would make more sense if you move it relative. Why would you want to move it absolute?

Member Avatar for pseudorandom21
0
368
Member Avatar for trelokamenos

Also check out [URL="http://en.wikipedia.org/wiki/Hidden_Markov_model"]HMM[/URL]

Member Avatar for mrnutty
0
108
Member Avatar for pcgamer2008
Member Avatar for eman 22

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

Member Avatar for cppgangster
0
324
Member Avatar for goocreations
Member Avatar for mrnutty
0
5K
Member Avatar for Ancient Dragon

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.

Member Avatar for Lardmeister
0
176
Member Avatar for shadowscape

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 …

Member Avatar for rubberman
0
155
Member Avatar for fadi_1234

>>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 …

Member Avatar for mrnutty
0
137
Member Avatar for Sonia11
Member Avatar for mike_2000_17
0
174
Member Avatar for Loki55

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. …

Member Avatar for ragedsparrow
0
104
Member Avatar for jamort
Member Avatar for mrnutty
0
97
Member Avatar for pcgamer2008

Look into [URL="http://openil.sourceforge.net/"]devIL[/URL]. Generally, for these things you would want to use an external library.

Member Avatar for mrnutty
0
111
Member Avatar for papaSmurph

Whats the point of car? I mean given the material we should be able to create one right?

Member Avatar for mrnutty
0
58
Member Avatar for Labdabeta

[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 …

Member Avatar for mrnutty
0
638
Member Avatar for manny23

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 …

Member Avatar for mrnutty
0
144
Member Avatar for fat0ali0ma

Just read the definition of Big-Theta and apply from that. That question is basically asking you to know what the definition means.

Member Avatar for mrnutty
-2
109
Member Avatar for pandaEater

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.

Member Avatar for Rashakil Fol
0
202
Member Avatar for Tinee

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]

Member Avatar for Tinee
0
252
Member Avatar for bkoper16

Try capital 'A' instead of lowercased 'a', in [icode] class Savings : public Account{...}[/icode]

Member Avatar for griswolf
0
10K
Member Avatar for failbot

prepend void before send(...), thus making send a function, because the compiler is thinking its a constructor of some sort.

Member Avatar for failbot
0
226
Member Avatar for lochnessmonster

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.

Member Avatar for mike_2000_17
0
92
Member Avatar for JohnBoyMan

Rule of thumb: When using pointers, if possible, use the arrow operator (->) When not using pointers, use the dot operator ( . )

Member Avatar for WaltP
0
86
Member Avatar for Mr. K

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] = …

Member Avatar for Mr. K
0
193
Member Avatar for ztdep

make it like so : [code] template<typename T> void Stack<T>::push(const T& val); [/code] notice the constant.

Member Avatar for mike_2000_17
0
177
Member Avatar for naseerhaider

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 = …

Member Avatar for mrnutty
1
3K
Member Avatar for kucing

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]

Member Avatar for jonsca
0
237
Member Avatar for mrnutty

What are your guys opinion about god? Are you guys atheists, theist, or don't care? Can we discuss about god.

Member Avatar for crunchie
0
871
Member Avatar for template<>

The End.