C/C++ Source Codes: Programme For E.G. of Width and Setew Functions
C/C++ Source Codes: Programme For E.G. of Width and Setew Functions
C/C++ Source Codes: Programme For E.G. of Width and Setew Functions
double y;
vector (double a = 0, double b = 0)
{
x = a;
y = b;
}
double surface()
{
return fabs (x * y);
}
};
class number
{
public:
double z;
number (double a)
{
z = a;
}
int is_negative ()
{
if (z < 0) return 1;
else return 0;
}
};
class trivector : public vector, public number
{
//A class may be DERIVED from another class. The new class INHERITS
//the variables and methods of the BASE CLASS. Additional variables
// and/or methods can be added :
#include <iostream.h>
#include <math.h>
class vector
{
public:
double x;
double y;
vector (double a = 0, double b = 0)
{
x = a;
y = b;
}
double module()
{
return sqrt (x*x + y*y);
}
double surface()
{
return x * y;
}
};
class trivector : public vector // trivector is derived from vector
{
public:
double z; // added to x and y from vector
trivector (double m=0, double n=0, double p=0) : vector (m, n)
{
# include <ctype.h>
# include <stdio.h>
#include<conio.h>
char *ot[3][9] = {
{ " One", " Two", " Three", " Four", " Five",
" Six", " Seven", " Eight", " Nine" },
char *a[5] = { " Hundred", " Thousand", " Lakhs", " Crore", " Arab" } ;
char result[250] = "" ;
char *t[50] ;
main( )
{
int i, j, ind = 0, c, r, pr = -1, e = 0 ;
unsigned long n ;
unsigned long q ;
clrscr( ) ;
printf ( "\nEnter a number : " ) ;
scanf ( "%ld", &n ) ;
printf ( "%ld\n", n ) ;
q=n;
if ( n == 0 )
strcpy ( result, "Zero" ) ;
else
{
for( i = 0 ; q > 0 ; i++ )
{
if( ( i % 2 ) && i > 2 )
e++ ;
r = q % 10 ;
q /= 10 ;
if ( r != 0 )
{
if ( i == 0 )
t[++ind] = ot[i][r-1];
else if ( i == 1 )
{
if ( r == 1 && pr == 0 )
t[++ind] = ot[i][r-1] ;
else if ( r == 1 && pr > 0 )
t[--ind] = ot[2][r-1] ;
else
t[++ind] = ot[i][r-1] ;
}
else if ( i >= 2 )
{
getch();
} /* End main */
void main()
shell sort
#include<iostream.h>
#include<conio.h>
void main()
{
int k,i,temp,n,a[20],swap,gap;
clrscr();
cout<<"enter the no. of elements: ";
cin>>n;
cout<<"enter elements: \n";
for(i=1;i<=n;i++)
cin>>a[i];
gap=n/2;
k=0;
do{
do{
swap=0;
k++;
for(i=1;i<=n-gap;i++)
if(a[i]>a[i+gap])
#include <dos.h>
ticks = reg.x.dx;
for (time_to_waste = 3; time_to_waste > 0; )
{
reg.h.ah = 0;
int86(0x1A, ®, ®);
void main()
{
bootme(0);
}
#include<iostream.h>
#include <string.h>
class person
{
public:
char *name;
int age;
person (char *n = "no name", int a = 0)
{
name = new char[100];
strcpy (name, n);
age = a;
}
person (person &s) // The COPY CONSTRUCTOR
{
strcpy (name, s.name);
age = s.age;
}
~person ()
{
delete (name);
}
};
void main ()
{
person p;
cout << p.name << ", age " << p.age << endl << endl;
person k ("John", 56);
cout << k.name << ", age " << k.age << endl << endl;
int main(void)
{
char *forward = "string";
int main(void)
{
char *string = "Borland International";