Posts
 
Reputation
Joined
Last Seen
Ranked #237
Strength to Increase Rep
+9
Strength to Decrease Rep
-2
92% Quality Score
Upvotes Received
63
Posts with Upvotes
49
Upvoting Members
32
Downvotes Received
4
Posts with Downvotes
3
Downvoting Members
4
22 Commented Posts
~128.80K People Reached
Interests
Algorithm development
PC Specs
Ubuntu and RHEL

164 Posted Topics

Member Avatar for stefy14

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 …

Member Avatar for amisha_1
0
58K
Member Avatar for dolly_olaide

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 …

Member Avatar for dddua
0
825
Member Avatar for kumar2884

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

Member Avatar for naveenture
0
545
Member Avatar for dusktreader

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

Member Avatar for GreenRiver
0
3K
Member Avatar for Silvershaft

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 …

Member Avatar for Stefano Mtangoo
0
468
Member Avatar for kirennian

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.

Member Avatar for dineshguru
0
1K
Member Avatar for neural_jam

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 …

Member Avatar for neural_jam
0
2K
Member Avatar for frogboy77

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

Member Avatar for frogboy77
0
125
Member Avatar for RFID46616c73

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

Member Avatar for RFID46616c73
2
1K
Member Avatar for nizbit

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

Member Avatar for dusktreader
0
538
Member Avatar for Sinaru

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 …

Member Avatar for arkoenig
0
168
Member Avatar for myk45

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 …

Member Avatar for myk45
0
3K
Member Avatar for grahf23

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

Member Avatar for grahf23
0
157
Member Avatar for tennis

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

Member Avatar for Duki
0
93
Member Avatar for senthamizh

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 …

Member Avatar for dusktreader
0
148
Member Avatar for helpme87

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

Member Avatar for mrnutty
0
149
Member Avatar for rowley4

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 …

Member Avatar for rowley4
-1
168
Member Avatar for harris21

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

Member Avatar for mrnutty
0
738
Member Avatar for harris21

@Narue Because of perverse curiosity, I must know. When and why have you used placement new before? Perhaps a hardware interface?

Member Avatar for mrnutty
0
300
Member Avatar for Stony

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

Member Avatar for dusktreader
0
243
Member Avatar for Duki

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]

Member Avatar for Duki
0
181
Member Avatar for laughnan

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 …

Member Avatar for Kanoisa
0
4K
Member Avatar for Nathaniel10

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

Member Avatar for mrnutty
0
183
Member Avatar for mimis

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.

Member Avatar for mrnutty
0
164
Member Avatar for ontherocks

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 …

Member Avatar for ontherocks
0
129
Member Avatar for xavier666

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]

Member Avatar for xavier666
0
146
Member Avatar for aikiart7

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 …

Member Avatar for aikiart7
0
223
Member Avatar for Nathaniel10

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

Member Avatar for Nathaniel10
2
141
Member Avatar for mike42intn

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

Member Avatar for mike42intn
0
232
Member Avatar for jasleen12345

You really need to post code demonstrating your problem. We have good imaginations, but this is a little sparse....

Member Avatar for dusktreader
0
86
Member Avatar for Rez11

[QUOTE=Rez11;1310778]Does it look clean?[/QUOTE] The code is actually pretty clean for a beginner! +1 for you. There are a few things you could do to improve it further. 1. Put the score input and score display sections in their own functions. It is always preferable to keep the main function …

Member Avatar for dusktreader
0
210
Member Avatar for shahanakazi

The purpose of homework is to learn how to solve problems similar to the ones you will face in your career. You must try to do your own homework. When you have struggled through some code and feel hopelessly stuck, post [B]specifically[/B] what you are trying to do with your …

Member Avatar for dusktreader
-1
174
Member Avatar for samsons17

[QUOTE=samsons17;1309471]Hi guys.... [CODE] if((number[i][j])%2==0){ [/code][/QUOTE] This is where your program goes wrong. You are testing whether the [B]value[/B] of the "matrix" at i,j is even or odd. Since you haven't initialized any of your values in the array, this will produce undefined behavior. When you allocate memory for an array …

Member Avatar for Fbody
0
132
Member Avatar for sDanyal

[QUOTE=sDanyal;969758]This is a incomplete code Complete this code by using Dev C++ for practice[/QUOTE] Don't post complete code for this. I'm almost certain this person wants you to do his homework for him. Asking for the code to be completed "by using Dev C++" is almost a certain give-away. No …

Member Avatar for dusktreader
-2
418
Member Avatar for potato4610

You could do this in an even cleaner fashion by using references. If you use const references, you can pass in values that have not been saved in a variable: [code] #include <iostream> #include <vector> using namespace std; const double& max( const double& a, const double& b ) { return …

Member Avatar for dusktreader
0
310
Member Avatar for miturian

My friend, you are suffering through pointer hell. The best way to avoid this is to use the standard template library. Vectors are infinitely nicer than dynamically allocated arrays of pointers. In order to understand your code, I had to work through it. In the process, i utilized the standard …

Member Avatar for miturian
0
353
Member Avatar for bobsta

Readability >>> clever tricks This code is painful: [CODE] ostream & operator << (ostream &out, const std::vector<beamlet> &b) std::ostream out1,out2; for (b::const_iterator it=b.begin();it!=b.end();++b){ if (it!=b.end()-2) out1 << it.left << "," << it.right << ",\n"; else out2 << it.left << "," << it.right << "\n"; out << out1 << out2; return …

Member Avatar for dusktreader
0
211
Member Avatar for rowley4

Your solution is not recursive. Recursive logic is very elegant and powerful, and for algorithm junkies like myself, completely awesome. The trick is understanding how recursion works. I'll use your reverse problem as an example. Suppose we want to reverse the string "Hello". Well, the fundamental problem is switching the …

Member Avatar for rowley4
0
330
Member Avatar for Isabelle

First of all, you should post the code for your classes so we can see the underlying logic. Secondly, you really don't need to do any casting here. Because the generate() function (I assume) is a virtual member of your base class, you should be able to call ptr->generate() with …

Member Avatar for Isabelle
0
126
Member Avatar for ivareske

When you run your program from the command line, redirect stderr to a file: [icode] $ myprogram 2> log.txt [/icode]

Member Avatar for vijayan121
0
173
Member Avatar for dusktreader

I notice that there are many, many threads where posters receive few if any comments. When I open these threads, it is usually obvious right away why no one has bothered to reply. The problems with these posts vary from deliberate solicitation for homework solutions to poorly composed questions. I …

Member Avatar for dusktreader
7
288
Member Avatar for emps

The problem here is that you are declaring an instance of a variable inside of your header file. You are essentially making [B]messages[/B] or [B]channels[/B] global variables. This would be fine [I]if the header was only included by a single source file[/I]. Here's what's happening. Every source file that includes …

Member Avatar for dusktreader
0
163
Member Avatar for finalheavenx

[quote=sonsofliberty84]i guess all you need is to place each input in an array and then do a bubble sort on that array, then output the first and last values.[/quote] There are two huge problems with your approach. First, your solution is doing way more than is necessary. If I was …

Member Avatar for dusktreader
-1
3K
Member Avatar for insanely_sane

As a fanboy of Qt, I recommend you research it a little. It's a very powerful cross platform GUI based on c++. Any programs you write using the Qt API can be built on windows, mac, and linux ( among others ). While drawing shapes in a QGraphicsView is not …

Member Avatar for ramox
0
335
Member Avatar for garea

Are you macro protecting your header files? [code=c++] #ifndef _SOME_HEADER #define _SOME_HEADER class SomeClass{...}; #endif [/code] or [code=c++] #pragma once class SomeClass{...}; [/code]

Member Avatar for rodc
0
815
Member Avatar for Codname47

[QUOTE=Codname47;1270524][CODE] myLinkedList ( ) { //TESTED head = NULL; last = NULL; cout<<"Linked List is created with default constructor\n"; } myLinkedList ( myLinkedList &arr) { //TESTED if (arr.head == NULL){head=NULL; last=NULL;} else{ head = NULL; last = NULL; temp2 = new node; temp2 = arr.head; while(temp2!=NULL){ insertLast(temp2->item); temp2 = temp2->next; …

Member Avatar for dusktreader
1
107
Member Avatar for Daqpan

Here's a litte bit of code that will help with your string/number conversion: [code] #include <string> #include <iostream> #include <sstream> #include <iomanip> /** Converts a number to a string * @param number - The number to convert * @param prec - Floating point precision to use * @param w - …

Member Avatar for dusktreader
0
135
Member Avatar for ChaseRLewis

The first problem is in your class definition. The scope operator` ( :: ) `is only used when your class is declared in one place (like a .h header file) and the functions are defined in another place (like a .cpp source file). When you are declaring and defining a …

Member Avatar for dusktreader
1
163
Member Avatar for BLKelsey
Member Avatar for mitrmkar
0
135
Member Avatar for Member 785122

Read this: [url]http://www.daniweb.com/forums/thread78223.html[/url] You need to show that you have tried to come up with a solution first. Also, why, oh, why is this posted as a poll?

Member Avatar for Excizted
-1
86

The End.