- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 63
- Posts with Upvotes
- 49
- Upvoting Members
- 32
- Downvotes Received
- 4
- Posts with Downvotes
- 3
- Downvoting Members
- 4
- Interests
- Algorithm development
- PC Specs
- Ubuntu and RHEL
Re: There is actually a very simple solution to this problem. First, you are trying to do two things here: [icode] 1. Split an input number into separate digits. 2. Add the digits together. [/icode] First of all, I would not recommend putting your input into an int type. If you … | |
Re: The basic problem with detecting bodies is the inconsistency of orientation. You'll notice that the Face detector is really only good at detecting faces that are pointed more or less toward the camera, and the detector does not find rotated faces well. This is because it is looking for similar … | |
Re: [QUOTE=kumar2884;1132180] But if we need to create a application for a particular device like mobile or digital camera we need to write in C or C++ with out using this libraries and it will take 100 to 200 likes depending up on our requirements is it right ? So all … | |
I am having some trouble getting some overloaded operators working correctly with a simple inherited Vector class (numerical vector, not container) The scalar multiply from the base class doesn't appear to be visible to the derived class. Code follows: Base Class Header [code=c++]#pragma once #include <vector> class Base { protected: … | |
Re: I'm a huge fan of Qt. I build a lot of Qt applications, and I'm really happy with this GUI. Trolltech, the makers of Qt, also provide a full-featured integrated IDE called [URL="http://qt.nokia.com/products/developer-tools/developer-tools"]QtCreator[/URL] that I actually use for my general purpose c++ coding. Qt is very flexible, has tons of … | |
Re: I haven't used them before, but I know a lot of people use [URL="http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation"]quaternions[/URL] to calculate 3 axis rotations. Apparently they compose better than using Euler angles. Have a look. Like I said, I haven't used them, but they might be what you are looking for. | |
Re: What it appears to me is that you have a specialized base-5 numbering system. It is specialized in that it has rules that dictate how you count down in this system. You could make this system very extensible and have it work with an arbitrary number of digits and arbitrary … | |
Re: You have a few problems: 1. This is a recusion problem, but you are not recursing correctly: [code] int g_c_d(int a,int b) { int c; c=abs(b-a); cout<<a<<" "<<b<<" "<<c<<endl;/*put this in to check it was going ok*/ if(c==0){return a;} if(b>a){b=a;} a=c; g_c_d(a,b); [B][COLOR="Red"]// This value should be returned[/COLOR][/B] }[/code] 2. … | |
Re: [QUOTE=LordNemrod;1326996]Die::Die() //Initializes Face data member { Face = 1,2,3,4,5,6; } I am not sure what you wanted to achieve by this, but this assigns 6 to Face. The operator comma works like this - it evaluates all of its arguments from left to right then returns the rightmost argument, in … | |
Re: [QUOTE=nizbit;1320079]I'm trying to find duplicates in an array and removing them by shifting the array index using the same array. I can't figure out where in my code the problem is but I'm still getting a duplicate. Could someone please help pinpoint the problem? I've tried debugging it but I'm … | |
Re: This is unnecessary code: [CODE] bool Candidate::operator ==(const Candidate& right) const { //return (firstName == right.firstName && lastName == right.lastName); // Rather than the above, I used this... return (static_cast<Person>(*this) == static_cast<Person>(right)); } [/CODE] If you do not define this operator in your derived Candidate class, the operator function from … | |
Re: I think the best way to achieve this is to wrap the functionality of a bitset with custom functions. So, to extend your bitset: [code] class TryBits { // whatever other functionality public: extend( const string& ns ) { // insert a check for ns to be a valid bit … | |
Re: [QUOTE=Fbody;1319894]On this site, a "space" or 2 is sufficient indent. A [I]TAB[/I] is too big.[/QUOTE] Actually, you shouldn't have actual tabs in your code. That is my opinion, and it is right. Code editors use monospace fonts ( at least they should, for the love of Turing ). Tabs are … | |
Re: [QUOTE=tennis;1320858]say iter1 and iter2 are both iterators [CODE]*iter1++=*iter2++;[/CODE] what does this line means? Can anybody help explain? ++ and * which is done first? thanks[/QUOTE] [URL="http://www.cppreference.com/wiki/operator_precedence"]Here's a page that will be very helpful![/URL] Operator precedence in c++ is important, but I prefer explicit code to implicit trickery. Parentheses are your … | |
Re: Yes, this code is broken. First, receive is not declared in the main function. You must first declare an object of type [B]bank[/B]. Secondly, you won't be able to use strcpy to write data directly into the c-string bank::receive unless you make a dangerous assumption. Most compilers place the private … | |
Re: **oh and i am using dev-c++ so i cant use strings** You should really consider using something besides dev-c++. Code::Blocks is a common suggestion. You should also know that dev-c++ isn't a language or a standard, so, aside from convenience for the classroom, it has no crucial place in the … | |
Re: Hrmmmmmmm... 1. Why do you need a [I]screenshot[/I]????? I really have to wonder why you would need a screenshot of a running application. I bet it has something to do with my second question: 2. Is this a homework assignment? This is the time of year when computer science classes … | |
Re: [QUOTE=Narue;1317680][B]>So in my view, I'm still right[/B] ...[/QUOTE] Righteous indignation is as heavy a cross to bear as defending an invalid thesis. @Mike She got you. You should at least admit it. @Narue You may be right, but I don't completely agree. One of the benefits of using pure virtual … | |
Re: @Narue Because of perverse curiosity, I must know. When and why have you used placement new before? Perhaps a hardware interface? | |
Re: [QUOTE=tayyab569;1317718]#include <iostream.h> #include <conio.h> void main(void) { clrscr(); int i,p; for(i=1;i<=300;i=i+1) { for(p=2;p<i;p=p+1) { if(i%p==0) break; else continue; } if(i==p) cout<<" Prime:"<<p; } getch(); }[/QUOTE] [COLOR="Red"]What the #&&$*% is this?[/COLOR] [B]1. [iCODE]void main()[/iCODE] is a great way to start fail code[/B] Please, for the love of any deity, use int … | |
Re: This should work: [code] int s = b.Activate(war.get_tp(), damage, 50); //prototype int Activate ( [B]const[/B] int &tp, int weaponDamage, int attack ); [/code] | |
Re: I wouldn't use getline for this. If you do so, you must take responsibility for tokenizing the lines and converting string data. The iostream library can do this automatically for you, so using ifstream and the >> operator is correct. My guess is that you are reading all of the … | |
Re: [code] void randnum(double lower, double upper, int n) // Generate 'n' random numbers uniformly distributed { // between lower and upper limits. double a = 0; double b = 0; srand((unsigned)time(0)); for (int i = 1; i < n+1; ++i) { a = rand(); b = lower + (a / … | |
Re: This definitely sounds like a job for a class not a struct. I'm surprised at the mixture of the STL with a struct that requires specific functionality. Is this an assignment for a class? If so, I wonder why your teacher isn't asking for a class with overloaded operators. | |
Re: Understanding pointers is [I][B]CRITICAL[/B][/I] to mastering C and C++. You should really go out onto the internet and read about pointers. You should work through some tutorials and examples. There is a lot of core concepts in pointer management. I don't think it would be appropriate to discuss it all … | |
Re: You could use the strcpy() function to acquire this functionality: [quote][code] int i; for(i = 0; i < length; i++) { strng[i] = str[i]; } [/code][/quote] | |
Re: This should work. Your function's definition matches your function's declaration. Your function's call matches both. Dev C++ causes problems and has compatability issues. Basically, it sucks and doesn't work well with established standards. You should consider getting a new IDE and compiler toolchain. I've heard that [URL="http://www.codeblocks.org/"]Code::Blocks[/URL] is a nice … | |
Re: [QUOTE=Nathaniel10;1311293]Thank you very much for your suggestions, Vijayan. I hadn't thought that having different classes for different exceptions was an appropriate formulation.[/QUOTE] I respectfully disagree. I believe that different exception types should have different class definitions. This paradigm is used extensively in many C++ libraries. I do agree that you … | |
Re: [QUOTE=mike42intn;1310686] [CODE] char sentance[40]; int i = 0; srand((unsigned)time(NULL)); for( i = 0; i <= 20; i++) { strcat_s(sentance, article[rand()%5]); strcat_s(sentance,noun[rand()%5]); strcat_s(sentance,verb[rand()%5]); strcat_s(sentance,preposition[rand()%5]); strcat_s(sentance,article[rand()%5]); printf("\n\n%s\n\n'", sentance); } } [/CODE][/QUOTE] My guess is that you are overrunning your sentence array. First, you should make it larger. 40 characters probably won't consistently … | |
Re: You really need to post code demonstrating your problem. We have good imaginations, but this is a little sparse.... |