Can any1 tell me about the tutorials and description regarding new c++ standard. specially the improvement in STL.

Member Avatar
Member Avatar
+0 forum 2

I want to generate the following pattern using for() loop only.... how can i do this i've tried but unfortunately failed to solve .... when user inputs 3 [COLOR=#008000]1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 when user inputs 4; [COLOR=#008000]1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 2 3 3 3 2 1 1 2 3 4 3 2 1 1 2 3 3 3 2 1 1 1 1 1 1 1 1 I …

Member Avatar
Member Avatar
-1 forum 4

i want to calculate the complexity of the following code snippet [code] for(int k=0;k<n; ++k) for(int j=0; j<k; ++j) for(int i=0; i<j; ++i) cout<< "Hello World" <<endl; [/code] here! i got the hint! that summation of natural numbers series would be used if its correct why ? bit confused:sad:

Member Avatar
Member Avatar
+0 forum 4

please help me understand the folowing code.... [code] class A { int a; public: A() : a ( 0 ) {} int get() { cout << "Hello WOrld " << endl; return 0; } }; int main( int argc, char** argv ) { cout<< ((A*)3)->get() << endl; return 0; } [/code] this code runs! and prints the correct output if i return zero in get() function,, but when i return a it throws an exception ( i think becuase a is not initialized, infact not constructed ), but this code runs ......no idea:eek:

Member Avatar
Member Avatar
+1 forum 5

I want to read a Source Code file and separate the lexemes (words) and want to track the line number with the separated words? I just come up with the raw code like that... i) A struct holding a string , int pair; ii) making the link list of above struct for example [code] class Container { struct Words{ string word; int lineNo; }; // vector<Words> vWord; int& operator[](string const& Value); //use to get the line number corresponds to given value; }; [/code] please tell me is there any optimal solution than this.........

Member Avatar
Member Avatar
+0 forum 8

I've just tried to code the Binder2nd, almost same as standard code provided in functional...... please point out the mistakes........ and suggest me guidelines to write effective code.......... [code] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <iostream>[/COLOR] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <vector>[/COLOR] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <functional>[/COLOR] [COLOR=#0000ff]#include[/COLOR][COLOR=#000000] <algorithm>[/COLOR] [COLOR=#0000ff] using[/COLOR][COLOR=#000000] [/COLOR][COLOR=#0000ff]namespace[/COLOR][COLOR=#000000] std;[/COLOR] [COLOR=#000000][/COLOR] [COLOR=#0000ff] template[/COLOR][COLOR=#000000] <[/COLOR][COLOR=#0000ff]class[/COLOR][COLOR=#000000] _Fn> [/COLOR] [COLOR=#0000ff]class[/COLOR][COLOR=#000000] Binder2: [/COLOR][COLOR=#0000ff]public[/COLOR][COLOR=#000000] unary_function[/COLOR] <[COLOR=#0000ff]typename[/COLOR] _Fn::first_argument_type, [COLOR=#0000ff] typename[/COLOR] _Fn::result_type> { [COLOR=#0000ff]protected[/COLOR][COLOR=#000000]:[/COLOR] [COLOR=#0000ff]typedef[/COLOR] [COLOR=#0000ff]typename[/COLOR] _Fn::second_argument_type sArg_; sArg_& secArg_; _Fn& fn_; [COLOR=#0000ff]public[/COLOR][COLOR=#000000]:[/COLOR] Binder2(_Fn [COLOR=#0000ff]const[/COLOR]& fn,[COLOR=#0000ff]typename[/COLOR] _Fn::second_argument_type [COLOR=#0000ff]const[/COLOR]& sArg) :fn_(fn),secArg_(sArg){} [COLOR=#0000ff]typename[/COLOR] _Fn::result_type [COLOR=#0000ff]operator[/COLOR]()([COLOR=#0000ff]typename[/COLOR] _Fn::first_argument_type& arg) { [COLOR=#0000ff]return[/COLOR] fn_(arg,secArg_); } }; [COLOR=#0000ff]template[/COLOR][COLOR=#000000]<[/COLOR][COLOR=#0000ff]class[/COLOR][COLOR=#000000] _Fn,[/COLOR][COLOR=#0000ff]class[/COLOR][COLOR=#000000] _Arg> [/COLOR] [COLOR=#0000ff]inline[/COLOR][COLOR=#000000] Binder2<_Fn> bind_(_Fn [/COLOR][COLOR=#0000ff]const[/COLOR][COLOR=#000000]& fn,_Arg [/COLOR][COLOR=#0000ff]const[/COLOR][COLOR=#000000]& arg)[/COLOR] { [COLOR=#0000ff]return[/COLOR] Binder2<_Fn>(fn,arg); } [COLOR=#0000ff]int[/COLOR][COLOR=#000000] …

Member Avatar
Member Avatar
+0 forum 1

I've gone through several books they explain Upcasting as Base class pointer pointing to Drived class Object this definition is correct. Downcasting: [quote]Drived class pointer pointing to base class object..[/quote] i got a bit confused.....not having crystal clear image in my mind..... if the above definition is correct... whats wrong with the below code [code] class Shape { public: virtual ~Shape() {} }; class Circle: public Shape { public: ~Circle() {} }; int main() { //why this can't work ...........according to definition.... // Circle* c = dynamic_cast<Shape*>(new Shape); //why this Shape* s = new Shape; Circle* c = dynamic_cast<Circle*>(s); return …

Member Avatar
Member Avatar
+0 forum 1

The End.