Object Oriented Concepts and Programming

Blog is for Object oriented concepts and prgramming. Specially for MCA GTU (Gujarat Technological University) student

RSS
  • Home
  • Edit

Google Android

Monday, November 1, 2010 by Vishal Joshipura | 0 comments
Hi,

     Lets take some look at the google android and fundamental, where you can develop your carrier with mobile technology.
http://vishaljoshipura.blogspot.com/2010/11/some-look-at-google-phone-google-andoid.html


System Software: Assignment - 2 Data Structure for Language Processing

Thursday, August 26, 2010 by vaibhav | 0 comments
System Software: Assignment - 2 Data Structure for Language Processing


my personal blog

Wednesday, August 4, 2010 by vaibhav | 0 comments
hi,
my personal blog is www.vagandhi.blogsopt.com where you will get information about current trends in Information Technology, How to prepare for job interview, What companies are expecting from students, etc.. along with technical articals


My blog for system software

by vaibhav | 1 comments
Hi all,
Plz refer my blog www.systemsoftware-mca3.blogspot.com for updates of system software


What actually passing by address means internally, pass by address is passing as value

Saturday, May 22, 2010 by Vishal Joshipura | 0 comments
When you pass an address to a function, that address is actually passed by value!
Because the address is passed by value, if you change the value of that address
within the function, you are actually changing a temporary copy. Consequently,
the original pointer address will not be changed!

Example:

#include "iostream"
#include "conio.h"
using namespace std;

void fun_test(int *);
int main()
{
    int value=50;  
    int *ptr = &value;      // Which means *ptr = 50
   cout <<<"Value Before : "<< *ptr;      // This will print 50
    fun_test(ptr);
    cout <<<"Value after : "<< *ptr;         // This will print 50
    getch();
    return 0;
}

void fun_test(int *arg_ptr)
{
    int fun_value=10;
    arg_ptr = &fun_value;    // This will print 10
    cout <<<"Value in function : "<< *arg_ptr;
}


Question :
         We are pass argument by address and if it is pass as value
         then why the change in its value is affected at the original
         calling place?

Answer   :
         When you change the value at the address
         then it will affect to the original memory address's
         content so its effect will still remains at the place
         from where the function calls and argument's
         address will be change by function statement.

Argument, Pass by address, Pass By argument

OOCP Material

Wednesday, May 5, 2010 by Dr. Parag Shukla | 0 comments


Download

OOCP Material

Program code for calculating Factorial of a no, How Recursive function will call and showing process of recursion.

Wednesday, April 21, 2010 by Vishal Joshipura | 0 comments
/*
  The Program for calculating factorial of a no.
  Here, Fact is a recursive function
  It will calculate factorial as below

 if user input is 4
 fact(4)        // call from main m=4,n=4;
 fact(4-1)*4 will call function it self as recursion
      fact(3)   m=3   
      fact(3-1)*3
          fact(2)
          fact(2-1)*2
               fact(1)    // it will return 1 to last cll of fact
          (1 * 2)      // 1 comes from upper call's return value
      ((1*2) *3) = (2*3)  //  2 comes from very upper call's return value
( (1*2*3) * 4) 
(6*4)=24                        // 6 comes from upper last call of fact's return values
and at last 24 will return to main


The program code for showing the recursion mechanism of function.
It will maintain stack call internally for manipulating function calls and
values at diffrent call.
*/
#include "iostream"
#include "conio.h"
using namespace std;

int fact(int m)
{
    if(m==1)
        return 1;
    return fact(m-1)*m;
}

int main(void)
{
    int no=5;
    cout<<"Enter No to calculate factorial of it : ";
    cin>>no;
    cout<<"factorial of "<< no <<" is  "<< fact(no);
    getch();
    return 0;
}

Fact, Factorial, Recursive Function

Startup code for C/C++, How actual program execuion starts.

Saturday, April 10, 2010 by Vishal Joshipura | 1 comments
Startup code for C/C++ programs usually consists of the following actions, 
performed in the order described:

1.Disable all interrupts.

2.Copy any initialized data from ROM to RAM.

3.Zero the uninitialized data area.

4.Allocate space for and initialize the stack.

5.Initialize the processor's stack pointer.

6.Create and initialize the heap.

7.Execute the constructors and initializers for all global variables (C++ only).

8.Enable interrupts.

9.Call main.

After Calling main it doesnt stop but also include few instruction after calling main and
then your code will start working....


How To Implement Default Argument in Function.

Thursday, April 8, 2010 by Vishal Joshipura | 1 comments
/*
This code shows how to use default argument in function
or how to create an optional parameter to the function

*/

#include

void div(int a,int b=1)
{
    float c;
    cout<<<"A is "<
    cout<<<"B is "<
    c= float(a)/b;
    cout<<<"A / B is "<
}


int main(void)
{
    int i=10,j=2;
    cout<<<"Default Argument";
    div(i,j);
    div(i);
    return 0;
}

/* Here Second parameter of div() function is
optional we can ommit it autometically consider
as Default argument value as 1*/

Defualt Argument

Example of Class

Wednesday, March 31, 2010 by Dr. Parag Shukla | 0 comments
/*1. Definition :

Create a class Item that has I_no, I_name
I_cost as data member and void getitem(void) & void putitem(void) as member functions.

*/

#include "iostream"
using namespace std;
class item
{
    private:
            int I_no,I_cost;
            char I_name[20];
    public:
            void getitem();
            void putitem();
};
void item :: getitem()
{
            cout<<"Enter The Item No...."; cin>>I_no;
            cout<<"Enter The Item Cost...."; cin>>I_cost;
            cout<<"Enter The Item Name...."; cin>>I_name;
}

void item :: putitem()
{
            cout<<"The Item No Is....";
            cout<<"The Item Cost Is....";
            cout<<"The Item Name Is....";
}

int main()
{

            system("cls");
            item i;
            i.getitem();
            i.putitem();
            system("pause");
}

Class, Item

Subscribe to: Posts (Atom)

Blog Archive

  • ▼  2010 (10)
    • ▼  November (1)
      • Google Android
    • ►  August (3)
      • System Software: Assignment - 2 Data Structure for...
      • my personal blog
      • My blog for system software
    • ►  May (2)
      • What actually passing by address means internally,...
      • OOCP Material
    • ►  April (3)
      • Program code for calculating Factorial of a no, Ho...
      • Startup code for C/C++, How actual program execuio...
      • How To Implement Default Argument in Function.
    • ►  March (1)
      • Example of Class

Followers

Labels

  • Argument (1)
  • Class (1)
  • Defualt Argument (1)
  • Fact (1)
  • Factorial (1)
  • Item (1)
  • OOCP Material (1)
  • Pass by address (1)
  • Pass By argument (1)
  • Recursive Function (1)

Contributors

  • Dr. Parag Shukla
  • Vishal Joshipura
  • vaibhav

Pages

  • Home
Copyright © 2010 Object Oriented Concepts and Programming