17 Discussion / Question Topics

Remove Filter
Member Avatar for subith86

I am planning to write an application in windows which will temporarily block the configured websites irrespective of what browser I am using. As I am completely a newbie in this I want to know where to start. Please provide me with any useful links which can help me. If …

Member Avatar for deceptikon
0
125
Member Avatar for subith86

I have a code which gives the maximum value I can get by filling the knapsack with the optimal set of weights. int arr[5] = {0, 0, 0, 0, 0}; int Weight[5] = {2, 5, 8, 7, 9}; int Value[5] = {4, 5, 7, 9, 8}; const int n = …

Member Avatar for Lucaci Andrew
0
332
Member Avatar for subith86

Anybody of you got any idea what this "internal compiler error: Segmentation fault" means? I searched internet, but didn't get anything useful. Then I did my analysis. I found out something peculiar. The code that I am trying to compile is a file for unit testing one of our classes. …

Member Avatar for mitrmkar
0
3K
Member Avatar for subith86

Hi, I have overloaded assignment operator like below and it worked perfectly fine. [CODE]void Test::operator = (Test& obj) { this->a = obj.a; this->b = obj.b; } [/CODE] But when I googled more about this, I could see all of the examples used a different prototype like this [CODE]Test& Test::operator = …

Member Avatar for subith86
0
135
Member Avatar for subith86

I am trying to implement my own version of BigInteger which can hold an arbitrary big integer. I have posted my BigInteger.h file here and I need your suggestions if there is any better design for this. 1. std::string private member will hold the BigInteger in the form of string. …

Member Avatar for VernonDozier
0
2K
Member Avatar for subith86

Hi all, Sorry if this is a stupid question. Assume I have a code like this. [CODE] char *temp = "poiuytrewq"; std::cout<<*temp<<std::endl; //should print p function(temp); std::cout<<*temp<<std::endl; //should print i [/CODE] Basically my function() in the above snippet increments the pointer twice so that temp point to 'i' now. I …

Member Avatar for subith86
0
179
Member Avatar for subith86

Hi all, Here is a short summary of my piece of code. [code] double availableUnits = calculateAvailableUnits(some arguments); int minimumRequiredUnits = getMinimumRequiredUnits(some arguments); std::cout<<"minimumRequiredUnits = "<<minimumRequiredUnits<<std::endl; //prints 30 std::cout<<"availableUnits = "<<availableUnits<<std::endl; //prints 30 if (availableUnits < minimumRequiredUnits) { //throw exception; } //rest of the code [/code] Even though both variables …

Member Avatar for Tumlee
0
204
Member Avatar for subith86

Hi all, I'm trying to get an octal number from console and store it in an int variable using scanf. Here is my code. [CODE] int n; scanf("%i", &n); printf("\nEntered number in dec = %d", n); printf("\nEntered number in hex = %x", n); printf("\nEntered number in oct = %o", n); …

Member Avatar for subith86
0
117
Member Avatar for subith86

Here the value of int x is always zero. I don't know if there is any case where it is non-zero. If so pls reply. [CODE]int OperOverld::operator--(int x) { cout<<x<<endl; //always zero //some code goes here //... //... //... //atlast return some int }[/CODE]

Member Avatar for Narue
0
176
Member Avatar for subith86

Hi friends, I was understanding the concept of friend functions. I read in my book that there are two possible ways of "making friendship":cool: 1. Make a class a friend. 2. Make the method in a class a friend. I am able to write a code for the first point. …

Member Avatar for jonsca
0
2K
Member Avatar for subith86

Hi friends, One of my class member function is supposed to return an array of integers. Here's the function. [CODE]int* MyClass::getallVars() { int* a = new int; int b[] = { GetparentVar1(), GetparentVar2(), GetchildVar1(), GetchildVar2(), }; a=b; return a; }[/CODE] Is there anyway I can do this without the use …

Member Avatar for subith86
0
176
Member Avatar for subith86

Hi friends, I was trying out some inheritance related stuff and found something. I just want to know the reason why. I have a ParentClass and a ChildClass. Both have an integer named [B]commonVar1[/B]. Also both have a getter method of the same name. Here goes the code. [CODE]class ParentClassOT …

Member Avatar for template<>
0
122
Member Avatar for subith86

Hi friends, I know this is such a freak code, but out of curiosity I did it to see memory usage increase using new operator. [CODE]int main() { char* a; for (;;) { //cout<<&a<<endl; a = new char[10]; } }[/CODE] As you see line7 is commented. When i run this …

Member Avatar for subith86
0
148
Member Avatar for subith86

while i was learning about global variables I did some trials and found one problem. Here goes my code. [CODE]int cows = 10; //global variable void farm1() { int cows; cout<<"in farm1, cows="<<cows<<endl; cows++; } int main() { //cout<<"in main, cows="<<cows<<endl; farm1(); //cout<<"back in main, cows="<<cows<<endl; } [/CODE] Here line …

Member Avatar for mike_2000_17
0
189
Member Avatar for subith86

I'm trying something like this [CODE]void receiver (char* x) { cout<<x<<endl; //prints "a" cout<<*x<<endl; //prints "a" cout<<&x<<endl; //prints address of x } int main() { char p = 'a'; cout<<p<<endl; //prints "a" cout<<&p<<endl; //prints "a" receiver(&p); } [/CODE] In the main function for both p and &p, it is printing …

Member Avatar for subith86
0
322
Member Avatar for subith86

In C++ I'm able to do something like this [CODE](some_condition)? function1():function2();[/CODE] When i tried the same thing in Java it's not possible. It wants some variable to hold the result even though the return type of function1 and function2 are void. Is there any other way to do it other …

Member Avatar for subith86
0
133
Member Avatar for subith86

Here is my piece of code: [CODE] int b[2][2] = { {4,6}, {-3,0} }; int b_length = (sizeof b)/sizeof(int); int *sub_b = b[1];[/CODE] b_length will have the length of 2-D array b (4, in this case). now sub_b is the sub-array of b at row 1, which is {-3,0} Is …

0
44

The End.