Your Ad Here

Sunday, December 21, 2008

Diamond In C

/* C program to display a diamond using arrays */

#include< iostream.h>
#include< conio.h>
void main()
{
int i,j;
clrscr();
int no;
cout< < "Enter A Value";
cin>>no;
for(i=no;i>=1;i--)
{
cout< < endl;
for(int k=1;k< =i;k++)
cout< < " ";

for(j=i;j< =no;j++)
cout< < "*";

for(j=i;j< no;j++)
cout< < "*";
}
//SECOND PART

for(i=no;i>=1;i--)
{
cout< < endl;
cout< < " ";
for(int k=no;k>=i;k--)
cout<<" ";

for(j=i-1;j>=1;j--)
cout< < "*";

for(j=i-1;j>1;j--)
cout<<"*";

}
getch();
}

Call By Reference in C

/* Program for inerchanging two numbers demonstrating Call By Reference in C */

#include<>
#include<>

void swap(int *,int *);

void main()
{
int x,y;
x=15;y=20;
clrscr();
printf("x=%d,y=%d\n",x,y);
swap(&x,&y);
//printf("\n%x %x",&x,&y);
printf("\n after interchanging x=%d,y=%d\n",x,y);
getch();
}

void swap(int *u,int *v)
{
int temp;
temp=*u;
*u=*v;
*v=temp;

return;
}

Call by Values in C

/* Program on interchanging two numbers demonstrating Call By Values in C*/
#include< stdio.h>
#include< conio.h>
void main()
{
int x,y;
x=15;y=20;
clrscr();
printf("x=%d,y=%d\n",x,y);
swap(x,y);
printf("\n after interchanging x=%d,y=%d\n",x,y);
getch();
}
swap(int u,int v)
{
int temp;
temp=u;
u=v;
v=temp;
return;
}

Pointers example

/* Example of pointers in C. Thsi program uses a function to modify a string using pointers */

#include< stdio.h>
#include< conio.h>
void main()
{
void getstr(char *ptr_str,int *ptr_int);
int var=5;
char *pstr="lionel";
clrscr();
getstr(pstr,&var);
printf("The value of var after modification using pointer in a function is %d,var");
}
void getstr (char *ptr_str,int *ptr_int)
{
printf("%s\n",ptr_str);
*ptr_int=6;
getch();
}

Two Dimentional array in C

/* C program to input and display a 2-d array*/

#include< stdio.h>
#include< conio.h>
void main()
{
int num[3][3],i,j;
clrscr();
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
scanf("%d",&num[i][j]);
}
}
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
printf("\n%d",num[i][j]);
}
printf("\n");
}
getch();
}

Thursday, December 11, 2008

Carlsberg launches Web-TV channel about football and fan life.

Recently Carlsberg Brewery launched a football web-TV-channel partofthegame.tv.

They launched 5 channels showing all aspects about football from the classic football matches to life as a fan.

Be sure not to miss the video clips about football funnies and rituals from the Football Magic channel or the bizarre story about fans in the stand and how fan culture sometimes go beyond reason.
As an extra feature you can upload your own favourite football and fan moments.

Its an amazing site with loads of features present in it. So log on to partofthegame.tv and experience the diference.

Your Ad Here