Tuesday, May 29, 2012

Access member variable from non member function in C++

Friend non member function can access private member variable also. following example help you to understand how to use friend keyword and how to access member private variables from non member function. #include <stdio.h> class Woman{ //making it friend friend void loveWoman(); private: int age; int salary; public: char name[50]; void walk(); }; //friend function void loveWoman(){ ...

Sunday, May 27, 2012

SQL Server Tips

1. How to get list of stored procedures in a database SELECT NAME FROM SYS.ALL_OBJECTS WHERE type= 'P' 2. How to get list of tables in a database SELECT * from sysobjects where type = 'U' 3. How to get list of databases in a SQL server SELECT name, collation_name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')...

Wednesday, May 23, 2012

How to convert integer number to a binary string in C++.

Converting integer to binary string is a very simple matter. for this there is a special class call "bitset". so fallow the example bellow and try to play around "bitset" For more information visit http://www.cplusplus.com/reference/stl/bitset/ #include <iostream> #include <bitset> void main(){ //creating instance using bitset (16 bit). here you can specify the length suc as ...