Wednesday, April 2, 2014

Mathematical Pre-requisities

Set:-
           Set is a collection of object without repetition and each object of set is called element of a set example D={x/x is a day of week}
Properties
1) Empty set  - It contains no elements denoted by ∅ {}.
2) Subset -  Set A is subset of B if every element in set A is in B denoted as A ⊂ B.
3) Equal sets -Two sets are equal if A ⊂ B and B ⊂ A..
4) Power set -A is a power set if 2A.Set of all subsets A
        For example if,
           A={1,2,3}
           2A={ {∅},{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3} }
          23=8 elements.
5) Compliment A' such that A'={x/x ∉ A}.
6) Union - A U B is all the elements in set A and B.
7) Intersection -A ∩ B is the element s both which is in A  and also in B.
8) Cardinality is the number of sets.


Relation :-  A relation R in set S is collection of ordered pair of elements in S.
Properties :-
1) Reflexive  -R is reflexive in S if xRx ∀ (for all) x ∈ S.
2) Symmetric -R is symmetric in x if xRy ⇒ yRx
3) Transitivie - R is transitive in x if xRy and yRz ⇒xRz
4)Equivalence relation -If relation is all three reflexive,symmetric and transitive.

Tuesday, April 1, 2014

Compile,Link and Run

Compile,Link and Run
        When you're ready to compile HELLOMSG, you can  select Build Hellomsg.exe from the Build menu,or press F7,or  select the Build   icon from the Build  toolbar.The appearance of this  icon is  shown in the Build menu.If the Build  toolbar  is not currently  displaned,you can choose Customize from the Tools menu and select the Toolbars tab.Pick Build or Build MiniBar.

      Alternatively you can select Execute Hellomsg.exe from the Build menu ,or press Ctrl+F5 or click the Execute program icon which looks like red exclamation point from the Build toolbar.You ''ll get a message box asking you if you want to build the program .

       As normal ,during the compile stage ,the compiler generates an .OBJ (object) file from the C source code file.During the link stage the linker combines the .OBJ file with .LLB (library ) files to create the .EXE(executable) file .You can see a list of these library files by selecting Settings from the Project tab and clicking the Link tab .In particular ,you'll notice KERNEL32.LIB,USER.LIB,and GDI.LIB.These are "import libraries " for the three major Windows sub-systems.They contain dynamic -link library names and reference information that is bound into the .EXE file .Windows uses this information to resolve calls from the program  to functions KERNEL32.DLL,USER.DLL,and GDI.DLL. dynamic0link libraries.

          In the Visual C++ Developer Studio ,you can compile and link the program in different configurations .By defaiult ,these are called Debug and Release .The executable files are stored in subdirectories of these names .In the Debug configuration ,information is added to the .EXE file assists in deubgging the program  and in tracing through the program source code.
              
         

Sunday, March 30, 2014

to be happy

 सुखी होने के दस उपाय। .......... 


१. काम में सदैव  व्यस्त रहो। 

२. अपनी क्षमता को पहिचानो। 

३. कभी कभी न बोलना भी सीखो। 

४. अपनी गलती स्वीकार करो। 

५. व्यवहारीक  बनो। 

६. सबको राय लेकर निर्णय लो। 

७. आए से जादा ख़र्च न करो। 

८. गहराई  से सोचो फिर बोलो। 

९. प्रतिक्षा  में धीरज रखो। 

१०. सबको सम्मान से बुलाओ। 

 

दुखी होने के दस कारण। ………………


१. देरी  से सोना और देरी से उठाना।
 

२.कोई  भी काम समय से न करना। 

३. किसीका भी विशवास न करना। 

 ४. सव्य  की  बात को ही सत्य बताना। 

५. कीसीके लिए कुछ  न करना। 

६. हमेशा सव्य  के लिए ही सोचना। 

७. लेन देन  का हिसाब ना रखना। 

८. बिना कारन झ़ुठ बोलना। 

९. बिना मांगे सलाह देना। 

१०. भुतकाल  के  सुख  को बहुत याद  करना। 
 

Pointers and void pointer and precedence of & and * operators in pointers.

Pointers
Definition:- A pointer is a variable that stores the memory address of another another variable.

void pointer :-( it can contain address of any data type )
syntax:-    void *pointer_name;
example:- void *v_ptr;
A void pointer does not have any data-type associated it with and can contain the address of any type of variable.
example:- void v_ptr;
                char ch;
                 int i;
                 float fvar;
                 v_ptr= &ch;
                 v_ptr= &i;
                 v_ptr =&fvar;

Precedence of & and * operator:-
Both are unary operators and have precedence equal to other unary operators.
Their associativity is from right to left.
example:-   int n=10,++*ptr;
                  ptr = &n;
                  ptr = 1024
                 
                   ++ *ptr =  ++(1024)
                                = ++(10)
                                = 11
  
                   *ptr++  = (*1024)++
                                =10 ++
                                =10

                    * ++ptr = *(++1024)
                                 = *(1026)
                                 = data at 1026


Sunday, March 23, 2014

Program of magic. magic.cpp

#include<iostream.h>
#include<conio.h>
int main()
{
   
    int i,ans=0;
    clrscr();
    cout<<"\nChoose one number in your mind from 1 to 63 \n";
    cout<<"\n1    3    5    7    9    11    13    15 \n";
    cout<<"\n17    19    21    23    25    27    29    31 \n";
    cout<<"\n33    35    37    39    41    43    45    47 \n";
    cout<<"\n49    51    53    55    57    59    61    63 \n";
    cout<<"Write 0 if number in your mind is present or else write 1 if not present\n";
    cin>>i;
    if(i==0)
    {
        ans=ans+1;
    }
    else
    {
        ans=ans;
    }


    cout<<"\n2    3    6    7    10    11    14    15 \n";
    cout<<"\n18    19    22    23    26    27    30    31 \n";
    cout<<"\n34    35    38    39    42    43    46    47 \n";
    cout<<"\n50    51    54    55    58    60    62    63 \n";
    cout<<"Write 0 if number in your mind is present or else write 1 if not present\n";
    cin>>i;
    if(i==0)
    {
        ans=ans+2;
    }
    else
    {ans=ans;}

    cout<<"\n4    5    6    7    12    13    14    15 \n";
    cout<<"\n20    21    22    23    28    29    30    31 \n";
    cout<<"\n36    37    38    39    44    45    46    47 \n";
    cout<<"\n52    53    54    55    60    61    62    63 \n";
    cout<<"Write 0 if number in your mind is present or else write 1 if not present\n";
    cin>>i;
    if(i==0)
    {
        ans=ans+4;
    }else
    {ans=ans;}
    cout<<"\n8    9    10    11    12    13    14    15 \n";
    cout<<"\n24    25    26    27    28    29    30    31 \n";
    cout<<"\n40    41    42    43    44    45    46    47 \n";
    cout<<"\n56    57    58    59    60    61    62    63 \n";
    cout<<"Write 0 if number in your mind is present or else write 1 if not present\n";
    cin>>i;
    if(i==0)
    {
        ans=ans+8;
    }else
    {ans=ans;}
    cout<<"\n16    17    18    19    20    21    22    23 \n";
    cout<<"\n24    25    26    27    28    29    30    31 \n";
    cout<<"\n48    49    50    51    52    53    54    55 \n";
    cout<<"\n56    57    58    59    60    61    62    63 \n";
    cout<<"Write 0 if number in your mind is present or else write 1 if not present\n";
    cin>>i;
    if(i==0)
    {
        ans=ans+16;
    }else
    {ans=ans;}

    cout<<"\n32    33    34    35    36    37    38    39 \n";
    cout<<"\n40    41    42    43    44    45    46    47 \n";
    cout<<"\n48    49    50    51    52    53    54    55 \n";
    cout<<"\n56    57    58    59    60    61    62    63 \n";
    cout<<"Write 0 if number in your mind is present or else write 1 if not present\n";
    cin>>i;
    if(i==0)
    {
        ans=ans+32;
    }else
    {ans=ans;}
    cout<<"The answer in your mind is : ";
    cout<<ans;
    getch();
    return 0;
}


Saturday, March 15, 2014

Program to find GCD of two numbers

#include<iostream.h>
int main()
{
int first_number,second_number,gcd,i;
cout<<"Enter First Number : ";
cin>>first_number;

cout<<"Enter Second Number: ";
cin>>second_number;

for(i=1;i<=first_number&&i<=second_number;i++)
{

     if(first_number%i==0 && second_number%i == 0 )
{
                     gcd=i;

    }

}

cout<<"Greatest Common Division (GCD):"<<gcd<<endl;
return 0;
}

******Output******
Enter First Number: 9
Enter Second Number: 24
Greatest Common Division (GCD):3 

What is GCD of two numbers?
 It means a greatest number which divides both numbers
For example: Two numbers are 9 and 24
Numbers which divides both are 1 and 3 in which greatest number is 3
So 3 is the GCD of 9 and 24

Click here for more programs on C++

Monday, March 3, 2014

Program in C++ to count heart beats of a person by its age from born

# include <iostream.h>
int main()
{
int age,heartbeats;
cout<<"Enter Age: ";
cin>>age;
cout<<"Enter Number of Heartbeats per min: ";
cin>>heartbeats;

heartbeats = heartbeats * 60; //heartbeats per hour

heartbeats = heartbeats * 24; //heartbeats per day

heartbeats = heartbeats * 365; //heartbeats per year

cout<<"Your Heart has beat "<<heartbeats * age<<" times since you were born."<<endl;

return 0;
}

-----------------------OUTPUT---------------------
 Enter Age: 26
 Enter Number of Heartbeats per min: 70
 Your Heart has beat  956592000  times since you were born.

List of bank names in India

 Here is a comprehensive list of banks in India, categorized by type: