- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I'm an IT Trainer with a reputed company in India. Subjects I deal mainly are C++, Computer Networks, Perl. Over 3 years of experience in training fresh graduates and corporates as well.
19 Posted Topics
Re: i would use a nested for loop (for accessing row and column) of a 2-Dimensional array. >> It just gives me random numbers and letters. (I understand that these are "gaps" in memory). No. Its the base address of the array (printed by statement on line 15 of your program. … | |
I was a C++ trainer for 3+ years and now am a developer with a software company. Last week, i had to undergo a C++ test on [url]www.brainbench.com[/url], as a part of my company's internal assessment. I scored 3.5 in the test (I'd gone unprepared at all). Can someone please … | |
Re: Good that you tried. I suggest, write a function separately for each, binary, octal and hex. How to? 1. Write a set of steps to convert a decimal to binary, in pure mathematical way. 2. Now try to write code in a function that maps to your steps. Pass your … | |
Re: This is a good question. If your base class has a virtual function, then typeid() will find out what type of derived object is your iterator pointing to. [CODE] cout << typeid(*(*baseItt)).name() << endl; [/CODE] | |
Hi, the code analysis tool we use gives below warning for the functions in which memset / memcpy is used "The function writes outside the bounds of dup on line 303, which could corrupt data, cause the program to crash, or lead to the execution of malicious code." could someone … | |
Hi, In the code snippet below, I tried to write the contents of a vector to a file using ostream iterator. However, when I try to read the contents of the file using istream_iterator, there is a problem. When the istream_iterator object is initialized using ifstream object fin, the istream_iterator … | |
Hi, While writing program for making a member function of one class a friend of another, VC++ is shooting two errors. The entire code is split across five files, 2 headers for two classes, 2 .cpp for the class members' definitions and 1 containing main() function. The headers are as … | |
Hi, I'm able to write a copy constructor for a class which contains pointer as a data member. However, when I have a reference as a data member, the copy constructor does not help, i.e. when I change that member for one object, the change is reflected in another one … | |
Hi, While trying a program from "C++ Primer 3rd Edition" by Stannley Lippman, I encountered with following two errors. 1. The book says that the header file fstream also includes the header iostream, so including just fstream will do. But g++ complained about cout, cin and cerr despite having fstream … | |
Hi, I have a header file in which I declare a class. A member function foo() is declared as inline. In another .cpp file, I define the function foo(). I create an object in main() (in another .cpp file) and invoke the foo() using that object. When I compile the … | |
Re: [QUOTE=tomtetlaw;916032]I am trying to initialize a vector inside a class's constructor, and I want the vector to be of type 'this' [code]std::vector<this>[/code] didnt work, [code] void* type = this; std::vector<type> [/code] that didn't work either, is there any other way to do it?[/QUOTE] [COLOR="Green"]In any of the member functions of … ![]() | |
Re: [QUOTE=nustian;917059]dear all plz i want help in this program can anyone do it...... Question: Derive a class from long_int class and add a member function "multiply" in the derived class to multiply two long_ints using the add member function already defined. multiply should work like this 2*3 = 2+2+2 (adding … | |
Re: change your if condition as below [code=c++] if(a < 0.7f) [/code] I do not remember the exact reason for the behavior in your code, it has got something to do with how floats are treated by the hardware. Someone please elaborate. | |
Hi, I have some questions on vector. Please consider the code below. I use g++ compiler on Linux. [CODE=c++] #include<iostream> #include<vector> using namespace std; class Sampler { int a; int b; }; int main() { vector <int> vec1; vector<float> vec2; vector<Sampler> vec3; cout << sizeof(vec1) << " " << sizeof(vec2) … ![]() | |
Re: [QUOTE=Yiuca;759051]Have you tried compiling it & seeing for yourself? The short answer would be no & there are quite a few reasons why & since it's late & I'm tired I'll go through it quickly... Elements of an array are the same type as the array, that is an int … | |
Re: Replace the function call in the line [I]attack3 = random_shuffle(attack1, attack2); [/I] by [B]attack3 = rand() / (int) (((unsigned)RAND_MAX + 1) / 8);[/B] include stdlib.h at the top. rand() returns an integer between 0 and RAND_MAX which is defined in stdlib.h int in the denominator for avoiding floating point result. … | |
Hi, I'm writing a template class as below. Trying to add a funtion to browse all the elements of an instance, that needs a vector iterator. When I compile the code getting a list of errors. Two of them typically draw my attention. The Error reads [B][COLOR="Red"]error:[/COLOR][/B] dependent-name ` std::vector<T,std::allocator<_CharT> … | |
Re: you can try something as below.... [code=cpp] #include<iostream> using namespace std; int main() { enum row {A, B}; bool aud[2][2] = { 0,0 }; for(int i=0; i<2; i++){ for(int j=0; j<2;j++) { cout << aud[i][j] << endl; } } int row; int seat; cout << "Enter your choice of seat-"; … | |
|
The End.