2,712 Posted Topics

Member Avatar for sidra 100

In my internship, they use the scrum method. It seems to be a good method. Google that.

Member Avatar for Rashakil Fol
0
352
Member Avatar for CPT
Member Avatar for mike_2000_17
0
176
Member Avatar for vergil1983
Member Avatar for K0ns3rv

You can delete line 158 and 193. Also quoted strings i.e [icode] "quotedStrings" [/icode] are automatically null terminated via compiler, so you don't have to manually add null character like you did here [icode]"-c\0"[/icode]

Member Avatar for mrnutty
1
323
Member Avatar for theguitarist

You need to remove the redundant code and use a function: [code] int getInt(){ int input = 0; while( !(cin >> input) ){ cout << "\nPlease enter a valid input: "; cin.clear(); while(cin.get() != '\n'); } return input; } int main(){ int x = getInt() , y = getInt(), z …

Member Avatar for m4ster_r0shi
0
189
Member Avatar for milan2011

In your peek check if size() == 0 instead. And for dequeAll just deque until size == 0

Member Avatar for milan2011
0
982
Member Avatar for ana_1234

Click on the file, hit "Ctrl + C" and goto the location where you want to paste it and hit "Ctrl + V" where the '+' means together or in conjunction.

Member Avatar for Narue
0
346
Member Avatar for mrnutty

Hypothetically speaking, supposed Mr.X was able to get into a restricted link in daniweb where Mr.X didn't have the privilege to do so regularly. What would happen to Mr.X is he was caught? Is there any laws against it?

Member Avatar for happygeek
0
132
Member Avatar for portege

>>it cracks the string h3ar7 in 16 seconds on my computer. Thats pretty slow. There is no reason to use recursion here.

Member Avatar for raptr_dflo
0
3K
Member Avatar for nocloud

>>[B]error: ‘template<class _Tp, class _Alloc> class std::vector’ used without template parameters[/B] This error tells you your problem. You are using std::vector without templates. Why are you confused?

Member Avatar for mrnutty
0
327
Member Avatar for murnesty

Make the member function a actual function. If more than one class actually needs it, then its nor correct to make it a member function for one class.

Member Avatar for mrnutty
0
138
Member Avatar for nocloud

[QUOTE=NathanOliver;1591717]You should be returning by reference not by value [code=c++] std::string & access(int row, int column); csv_File & grab(int index); [/code][/QUOTE] And also provide a const reference version

Member Avatar for mike_2000_17
0
202
Member Avatar for mrnutty

Feel free to ignore this rant. I am up to my neck with programming, so much so that I'm getting sick of it. I know I can't believe I would ever say that either. I'm at work right now( internship ), and I just want to leave. I don't want …

Member Avatar for mrnutty
0
112
Member Avatar for learningcpp

[QUOTE=learningcpp;1591459]Thanks for the reply. What if I want to avoid this, lets say I have to create 10 millions of this object (10 million is too much?, mmm lets say I have unlimited memory?) then this padding will cost me 30 million of extra byte. I have tried the rearranging …

Member Avatar for mike_2000_17
0
174
Member Avatar for mrnutty

Time to time I see some common mistakes or even make some my self. I figure I would post some of these, with hopes that people will learn from my and others mistakes. [B]1) Why you no work?[/B] [code] int sum = 0; for(int i = 1; i < MAX; …

Member Avatar for Moschops
0
144
Member Avatar for F.O.G

Why don't you give it a try. If your stuck on something post it. We can surely do this for you, but then when time comes for you to work on your own, then your gonna have a heck of a hard time. So start early and start now. So …

Member Avatar for LevyDee
-3
124
Member Avatar for Tweekler
Member Avatar for xpartmgr

Note you should expose your vector like that instead return it by const-reference and if you need to update it, then provide proper interface. Also typedefs also might come in handy, as it is more clearer. [code] typedef std::vector<MySurvey::SurveyQuestion> Questions; //... const Questions& getSurveyQuestions()const{ return questions; } [/code]

Member Avatar for mrnutty
0
128
Member Avatar for Labdabeta

Look into [URL="http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=opengl"]opengl[/URL]

Member Avatar for dvidunis
0
249
Member Avatar for massivefermion

[QUOTE=Ancient Dragon;1588290]When you get a first entry-level programming job you will most likely not be writing all new code yourself, but instead you will be modifying and debugging existing code (program maintenance). The only new code you might write is to make product enhancements to existing products. No one is …

Member Avatar for Ancient Dragon
0
440
Member Avatar for dilequeno

Sorting and binary search will take nlogn + logn time. Instead you can simply run through the list and spit out anyone that satisfies the requirement-- this takes linear time.

Member Avatar for L7Sqr
0
886
Member Avatar for Jsplinter

[QUOTE=Jsplinter;1588388]How do I invoke the int operator < instead of the int* operator < ? [CODE] vector<int*> pVec; std::sort(pVec.begin(),pVec.end(), /*????*/); [/CODE][/QUOTE] Why do you need to store [i]int*[/i] anyways? Either store it as [I]vector<int>[/I] or [I]vector< vector<int> >[/I]

Member Avatar for Jsplinter
0
5K
Member Avatar for Thisisnotanid
Member Avatar for Moschops
0
238
Member Avatar for Vidgie65

>>[B]Random ;*randSelection;[/B] what do you think this means? I assume you want [icode]int randomSelection [/icode]. And add a semicolon after '}' in line 62

Member Avatar for mike_2000_17
0
383
Member Avatar for xpartmgr
Member Avatar for emmaand

Use a if statement and a state variable. [code] int main(){ bool shouldContinue = true; do{ /***code here***/ //ask user if he want to continue char input; cout << "Continue(y/n) : " ; cin >> input; if(input != 'y') shouldContinue = false; }while(shouldContinue); } [/code]

Member Avatar for murnesty
0
8K
Member Avatar for MareoRaft

[QUOTE=invisal;1578241]I don't see anywhere stated that [icode]int main(int argc, char* argv[])[/icode] is better than [icode]int main()[/icode]. I wonder whether [icode]char main()[/icode] is acceptable?[/QUOTE] Quoted from wiki-god [quote] C and C++ In C and C++, the function prototype of the main function looks like one of the following: int main(void) int …

Member Avatar for Raphaelnad
0
458
Member Avatar for iamthwee

I always workout and play basketball. Right now, my goal is to get my body fat percentage under 10%. I need the extra edge for basketball. But I recently started eating salad and chicken for dinner, to avoid carbs as much as I can at night time.

Member Avatar for hotmatrixx
0
140
Member Avatar for crapgarden

Just one more things, for question 2, its not a char type, its a array to chars, which is why in the above post, you see an array of chars

Member Avatar for crapgarden
0
189
Member Avatar for Lilcrew

[QUOTE=Schoil-R-LEA;1584863]As the problem instructions say, you need to have the second loop nested inside the first loop. in this case, all you really need do is remove the two cout lines between the loops, and move the endl off of the the inner loop's output, and you should be good …

Member Avatar for mrnutty
0
137
Member Avatar for ichigo_cool

Don't initialize the variables in the header file. Initialize them in the .cpp file. In the header file, just declare them. Alternately you can do this: [code] //foo.h struct Constants{ static const float PI; static const float DEGTORAD; //... }; [/code] [code] //foo.cpp const float Constants::PI = 3.1415f; //... [/code] …

Member Avatar for mrnutty
0
564
Member Avatar for eman 22

@OP you want this I think: [code] template<typename R, typename T> R cast(const T& input){ stringstream stream; stream << input; R ret = R(); stream >> ret; return ret; } int main(){ int i = cast<int>("12345"); float pi = cast<int>("3.1415"); } [/code]

Member Avatar for m4ster_r0shi
0
614
Member Avatar for Labdabeta

[code] void dofunc(int a, int b){a+=b;} void foo(int near,int far){dofunc(near,far);}//Syntax error, expected primary expression before , and ) void poo(int vnear,int vfar){dofunc(vnear,vfar);}//Compiles fine? int main(){} [/code] that works fine for me? Whats the real code ?

Member Avatar for Salem
0
171
Member Avatar for mrnutty
Member Avatar for sergent
0
83
Member Avatar for mrnutty

First of all, I am a confused christian, and I am creating this thread to see if I can clear out some fog in my head. So lets start. Claim: The bible is false in the sense that it was not written with the guidance of "god" Reasons for my …

Member Avatar for iamthwee
2
1K
Member Avatar for paperstars

Your factorial is wrong. Since you are updating by 2, you are missing terms in your factorial. Separate the factorial into its own function. Or do this: [code] double sineSeries(double x, int n){ double xPower = 0.0; double factorial = 1.0; double sineComputed = 0.0; bool sign = true; for …

Member Avatar for paperstars
0
2K
Member Avatar for UltimateKnight

[QUOTE=UltimateKnight;1582999]Hey all. When you have the whole program running, and is executed it's running at the black console window. How are the programs made so that they run with GUI interface and stuff like that? Are they exported differently and where are the images and things put together ? Thanks.[/QUOTE] …

Member Avatar for ichigo_cool
0
325
Member Avatar for akhal

>>[B]#define J sqrt(-1.0)[/B] there is no such thing as sqrt(-1.0), the parameter to sqrt shouldn't be negative. Instead just imagine the second paramter of complex type is imaginary. [code] typedef std::complex<float,float> Complex; typedef std::vector<float> TimeDomainData; typedef std::vector<Complex> FrequencyDomainData; int main(){ const int SAMPLE_POINTS = 1024; const TimeDomainData data = generateTimeDomainData(SAMPLE_POINTS); …

Member Avatar for akhal
0
325
Member Avatar for theguitarist

In the first while loop your exit condition is when cin fails. It will fail when it reads in something that its no supposed to. Its expecting a integer( a number ), and if you pass it a character, then cin fails and it sets the failure bits accordingly. Now …

Member Avatar for theguitarist
0
2K
Member Avatar for Raim

[QUOTE=Raim;1580108]Thanks, that sure helped me. The code is here for anyone that might want to take a look at it: [CODE]int n; double sum = 0; //promt user to enter the number. cin>>n; for (int i = 0; i<=n; i++) { sum+=i; } cout<<sum <<endl; //demonstrating the result[/CODE][/QUOTE] This gives …

Member Avatar for Raim
0
162
Member Avatar for Ertzel

[QUOTE=LevyDee;1581255]You can't compare character arrays like that. Your best bet is to create a function that will do a loop check of each element in the two arrays. And have it return a boolean. aka [code] bool isEqual(char onFile[], char checking[]) { for(int i = 0; i < (sizeof(onFile) / …

Member Avatar for Ertzel
0
147
Member Avatar for iamthwee

[QUOTE=iamthwee;1579938]Is this too easy... Looks like the minimax algo more or less achieves perfect play once it plays all the games...[/QUOTE] Yea exactly, you don't even have to use minmax, following a simple series of rules can produce unbeatable tic-tac-toe AI.

Member Avatar for pseudorandom21
0
178
Member Avatar for Spillman

[QUOTE=Spillman;1580295]Just learned that you can't use case/switch with strings in C++. So... used if/elseif: [CODE] if (theCategory=="colors") getCatArrAndVals(colors); else if (theCategory == "fruits") getCatArrAndVals(fruits); else if (theCategory == "veggies") getCatArrAndVals(veggies); [/CODE] If anyone has a sleeker way of doing this, please let me know. TIA[/QUOTE] Sure [code] #include <map> #include …

Member Avatar for Spillman
0
237
Member Avatar for SakuraPink

To see if a number is even you can just check the remainder when divided by 2 or check the last bit. For floating number, you can just check the integer part, so there is no need to use fmod since comparing it to 0.0 might not do what you …

Member Avatar for SakuraPink
0
221
Member Avatar for henrimontreal

You need to apply the following transformation. 1) Remove all nonalpha characters 2) Convert all character to lowercase 3) Compare it to its reverse( or compare begin + i to end - i ) To remove all nonalpha characters to a string you can use the following: [code] struct IsNotAlpha{ …

Member Avatar for vijayan121
0
126
Member Avatar for killingmonk

I don't get you problem, this is what I get for input of 3000. [code] pppppp oooooo w w w eeeeeeee rrrrrrr cccccc oooooo p p o o w w w e r r c c o o p p o o w w w e r r c o …

Member Avatar for killingmonk
0
222
Member Avatar for jbennet

If your ultimately wanting to play sound then I would suggest using a library that handles reading and playing sounds for you already. A suggestion would be to use FMOD. Or if you just want to develop on windows then you can use the [i]PlaySound[/i] function

Member Avatar for raptr_dflo
0
3K
Member Avatar for pcgamer2008

If you are using sdl, then you can use sdl_mixer. But the suggested ones are openAL and FMOD

Member Avatar for pcgamer2008
0
1K
Member Avatar for ssesham1

Check if your compiler supports [URL="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.14"]export keyword[/URL], although note that its being removed from the standard.

Member Avatar for thekashyap
0
437
Member Avatar for merse

You should do something like this : [code] const string& stringToAvoid = "#\n"; string line; while(getline(cin,line)){ if(stringToAvoid.find(line[0]) != string::npos) continue; } [/code] that way you can just add more character to [i]stringToAvoid[/i] instead more if's

Member Avatar for mrnutty
0
215

The End.