Posts
 
Reputation
Joined
Last Seen
Ranked #928
Strength to Increase Rep
+3
Strength to Decrease Rep
-0
50% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
2 Commented Posts
~4K People Reached
Favorite Forums
Favorite Tags
c++ x 22
Member Avatar for jerryjerry

The differences I think are in that, with data-members declared public, the user(the code which instantiates/uses this class) has to totally manipulate the data-members by itself.. e.g. [CODE] class Rect { public: int w, h; int area; }; [/CODE] In above code, if user wants to know the area, he …

Member Avatar for Fbody
0
151
Member Avatar for corby

@Corby, Assuming the followig Package.h, it worked fine for me.. started taking input from sender's name to receiver's zip code, and then outputted data in proper format too, though i had to add main function to the cpp file because yours is not visible in the code you submitted.. Let's …

Member Avatar for corby
0
105
Member Avatar for gregarion

@gregarion, I'm not sure what you're trying to do with the array str.. But I guess your goal was to find the number of occurence of certain characters in the array str. But that won't be given by find function. size_t find ( const char* s, size_t pos, size_t n …

Member Avatar for mrnutty
0
153
Member Avatar for dmr215

@dmr215, please provide the code which you say is almost working. This code is far from even compiling let alone execution. Another observation is that this code's written a lot from the POV of java(don't know about PHP as i've never used that.) e.g. 1. unlike java, in C++ all …

Member Avatar for tintin.iitk
0
161
Member Avatar for 2koolguy

Here's the corrected code.. Your problem mainly was that you hadn't put indexes while using your arrays.. rest is almost the same.. I almost did indent the code as otherwise it was impossible to understand. [code] #include<iostream> #include<string> using namespace std; enum Identification { Idstudent, Idworker, Idstudentworker }; class person …

Member Avatar for 2koolguy
0
199
Member Avatar for wittykitty

I completely agreew with Banfa' explanation.. Something like this should do: [code] Term& Term::operator +=(const Term &t) { if (exponent == t.exponent) { coefficient += t.coefficient; //exponent = t.exponent; // it's basically a redundant statement as exponent = t.exponent as per the if condition } // Don't forget to add …

Member Avatar for wittykitty
0
114
Member Avatar for aswin cp

How about: [CODE] max = max2 = first while not eof do if value > max then max2 := max max := value else if value > max2 then max2 := value end if loop [/CODE]

Member Avatar for tintin.iitk
0
278
Member Avatar for tintin.iitk

e.g. [CODE] class B { public: virtual ~B() {printf("Base class Destructor");} }; class D { public: ~D() {printf("Derived class Destructor");} }; [/CODE] Is it somehow possible to altogether avoid printing 'Base class Destructor' when an object of class D is destructed (of course without causing a memory leak).. If you …

Member Avatar for tintin.iitk
0
2K
Member Avatar for Wong23

[code] template <typename T, int m, int n, int p> Matrix<T, m, p> operator *(const Matrix<T, m, n>& A, const Matrix<T, n, p>& B) { Matrix<T, m, p> ret; for (int i = 0; i < m; i++) for (int j = 0; j < p; j++) { ret[i][j] = …

Member Avatar for tintin.iitk
0
110
Member Avatar for tintin.iitk

class A { A& a; public: A(): a(* new A()) {} }; There is a huge flaw here and before I compiled this code I was hoping that it will fail to compile, But it didn't. At first I felt like I had a big flaw in C++ as it …

Member Avatar for gusano79
0
244
Member Avatar for Muathelbou

After looking at other posts and warnings, I have edited this post so as to remove half of the functions, so the person who started the thread has to do some of the work himself [CODE] /** * file name: charRoutines.cpp * author: Nitin Garg */ #include "charRoutines.h" #define NUM_CHARS …

Member Avatar for tintin.iitk
0
223
Member Avatar for Narue

Corresponding C++ code. :) #include <cstdlib> #include <iostream> #include <iomanip> #define SYSTEM_OUT_PRINTLN(x) {cout << x << endl;} namespace scratchpad { class Comparable { virtual int compareTo(const Comparable& other) = 0; }; class Integer: public Comparable { public: Integer(int i = 0) {val = i;} int compareTo(const Comparable& other) { return …

Member Avatar for majestic0110
1
358