Showing posts with label Coding Of Ten Random Numbers. Show all posts
Showing posts with label Coding Of Ten Random Numbers. Show all posts

Wednesday, 24 October 2012

Program Of Ten Random Numbers


#include <stdio.h>
#include <iostream.h>


void main()

{

int i,j,k,l,list[1000];

FILE *fp;

char any[8];

cout << "Enter a file name\n";

cin >> any;

fp = fopen(any,"wb");
    
for(j=0;j<50;j++)

    {
     
  for(i=0;i<200;i++)
    
   {
 
 k = rand() % RAND_MAX;
  

       }

    }


    i = 0;
   

    {
 
 list[i] = l;

 i = i + 1;

    }

fclose(fp);

for (i=0;i<50;i++)
    
cout << list[i] << '\n';



}



Friday, 19 October 2012

Program Of Pure Virtual Function In C++

#include< iostream.h>
#include< conio.h>
{
protected :
int a,b;
public:
{ 
cout<< "\nEnter two 'int' values::";
cin>>a>>b;
} 

}; 
class xyz:public abc
{
public:
void display()
{
cout<< "\nSum for 1st derived class="<< a+b;
}
};
class mn:public abc
{
public:
void display()
{
cout<< "\nSum for 2nd derived class:"<< a+b;
}
};
void main()
{
clrscr();
xyz ob;
mn ob1;
abc *ptr;
ptr=&ob;
cout<< "\nFor object of 1st derived class."<< endl;
ptr->display();
cout<< "\nFor object of 2nd derived class."<< endl;
ptr=&ob1;
ptr->take();
getch();
}

--------------------------------------------------------------------------------------------------

Pure  Virtual Function

In object-oriented programming, a  virtual method is a function or method whose behaviour can be overridden within an inheriting class by a function with the same signature. This concept is a very important part of the polymorphism portion of object-oriented programming (OOP).


by:---http://en.wikipedia.org/wiki/Virtual_function