C Program to create a Star of Numbers in C

C Program to create a Star of Numbers in C

main()
{
int i,j,k;
clrscr();
for(i=1;i<=3;i++)
{
for(j=1;j<=3;j++)
{
for(k=1;k<=3;k++)
{
if(i==j||j==k||i==k)
{
continue;
}
else
{
printf("\n%d%d%d",i,j,k);
}
}
}
}
getch();
}

Related Links :

C Program to Sort an array in ascending order

C Program to Sort an array in ascending order


#include
#include
void main()
{
int num[10],i,j,temp;
clrscr();
printf("\n Enter 10 values of an array...........\n");
for(i=0;i<10;i++)
scanf("%d",&num[i]);

printf("\n array before sort .........\n");
for(i=0;i<10;i++)
printf("%d\t",num[i]);

for(i=0;i<9;i++)
{
for(j=i+1;j<10;j++)
{
if(num[i]<=num[j])
{
temp=num[i];
num[i]=num[j];
num[j]=temp;
}
}
}

printf("\n array after sort .........\n");
for(i=0;i<10;i++)
printf("%d\t",num[i]);

getch();
}





Related Links :

C Program to swap the numbers by using Pointers and user defined function

C Program to swap the numbers by using Pointers and user defined function.




#include
#include
void swap(int,int);
void swap1(int *,int *);
void main()
{
int x,y;
clrscr();
printf("\n Enter two values :");
scanf("%d%d",&x,&y);
printf("\n before swap pass by values.........\n");
printf("\n x=%d\ty=%d",x,y);
swap(x,y); //pass by value
printf("\n after swap by values.........\n");
printf("\nx=%d\ty=%d",x,y);

printf("\n before pass by address.........\n");
printf("\n\tx=%d\ty=%d",x,y);
swap1(&x,&y);
printf("\n after pass by address .........\n");
printf("\\tnx=%d\ty=%d",x,y);
getch();
}
void swap(int a,int b)
{
int t;
t=a;
a=b;
b=t;
}
void swap1(int *a,int *b)
{
int t;
t=*a;
*a=*b;
*b=t;

Related Links :

C Program to Find Factorial of given number except negative number

C Program to Find Factorial of given number except negative number.

#include
#include
void main()
{
int n,num;
clrscr();
long fact=1;
printf("\n enter the number");
scanf("%d",&n);
num=n;
if(n<0) printf("no factorial of negative number"); else { while(n>1)
{
fact*=n;
n--;
}
printf("factorial of %d=%ld",num,fact) ;
}
getch();
}


Related Links :

C Program to enter employee record & search the employee by employee ID by using structures in C

C Program to enter employee record & search the employee by employee ID by using structures in C



#include
#include
#include
struct employee
{
char name[20];
int age;
float salary;
int empid;
};
void SearchEmployee(struct employee*);
void main()
{
struct employee e1[5];
int i;
clrscr();
printf("\n Enter the details of 5 employee ..........\n\n");
for(i=0;i<5;i++)
{
fflush(stdin);
printf("\n enter Name :");
gets(e1[i].name);

printf("\n enter age ,salary and empid of %d employee :",i+1);
scanf("%d%f%d",&e1[i].age,&e1[i].salary,&e1[i].empid);
}
SearchEmployee(e1);
getch();
}
void SearchEmployee(struct employee * ptr)
{
int i,id;
printf("\n enter employee id :");
scanf("%d",&id);
for(i=0;i<5;i++)
{
if(ptr[i].empid==id)
{
printf("\n Employee name=%s",ptr[i].name);
printf("\n Employee Age=%d",ptr[i].age);
printf("\n Employee id=%d",ptr[i].empid);
printf("\n Employee salary=%f",ptr[i].salary);
}
}
}
void link()
{
float f,*ptr;
ptr=&f;
}





Related Links :

C Program to convert string to integer

C Program to convert string to integer

Solution 1:

#include
#include
int main(){
char str[50];
int number;

//Accepting a numer in string format
printf("Enter any number as a string : ");
scanf("%s",str);

//Converting string into the number;
number = atoi(str);
if(number==0 && str[0]!='0')
printf("\nInvalid number");
else
printf("\n Equivalent number is : %d",number);
return 0;
}




Solution 2:

#include
#include
#include
#include

char * toString(int);
int main(){
int number;
char *string;

//Accepting a number from user
printf("Enter any integer number : ");
scanf("%d",&number);

//Checking number is valid or not
if(isdigit(number)==0){
printf("\nInvalid number");
//exit(1); //to exit from program
}

//Converting int to string
string = toString(number);

//printing the string in console
printf("\nEqivalent string: %s",string);
return 0;
}

//function to conver int into string
char * toString(int num){
static char str[50];
char *ptr =(char *) #
int i,length=0,temp,le;
temp=num;
while(temp){
temp = temp/10;
length++;
}
le=length;
printf("le %d",length);
for(i=0;i<=le;i++){
printf("%d",num/pow(10,length) + 48);
num= num + (pow(10,length--));
}
str[i]='\0';
return str;
}

Related Links :

Printing Char in C , Type of Printf Functions in C

These predefined functions has been defined in the header file stdio.h
Some important functions are:

1. printf
2. cprintf
3. fprintf
4. vprintf
5. sprint
6. vfprintf
7. vsprintf
8. fputc
9. putc
10. putw
11. fputchar
12. puts
13. putchar
14. fwrite

Related Links :

Program to display the entire environments vector


#include
int main(int count,char *arg[],char *argvect[]){
int i=0;
while(argvect[i]) {
printf("\n%s",argvect[i]);
i++;
}
return 0;
}



Related Links :

c program to create dos command dir



#include
#include
int main(int count,char *argv[]){
struct find_t q ;
int a;
if(count==1)
argv[1]="*.*";
a = _dos_findfirst(argv[1],1,&q);
if(a==0){
while (!a){
printf(" %s\n", q.name);
a = _dos_findnext(&q);
}
}
else{
printf("File not found");
}
return 0;
}

Related Links :

Program to create a table of given number in C



#include
#include

void main()
{
int num,i;
clrscr();

printf("\nENTER THE NUMBER OF WHICH TABLE IS TO BE PRINTED : ");
scanf("%d",&num);

for(i=1;i<11;i++)
{
printf("\n%d x %2d = %2d",num,i,(num*i));
}
getch();
}


Related Links :

KAUN BANEGA CROREPATI Game Program in C


#include
#include

void question1();
void main()
{
clrscr();

printf("\n\n\n\n\n\n\t\t\t\t ______________\
\n\t\t\t\t | Hello And WELCOME TO\t|\
\t\t\t\t\t\t\t | KAUN BANEGA\t|\
\t\t\t\t\t\t\t | CROREPATI\t|\
\n\t\t\t\t |______________|\n");
getche();
question1();
getch();
}
char a,b,c,d,A,B,C,D,ans;
void question2();
void question1()
{
clrscr();
fflush(stdin);
printf("\nQ1.What does AC and DC stand for in the electrical field?");
printf("\n A. A Rock Band from Australia\t B. Alternating Current and Direct Current");

printf("\n C. Average Current\t and Discharged Capacitor\
\nD. Atlantic City and District of Columbia ");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'C':
case 'c':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'B':
case 'b':
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.1,000!!");
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}

if(ans == 'B' || ans == 'b')
{
getche();
clrscr();
question2();
}
}
void question3();
void question2()
{
clrscr();
fflush(stdin);

printf("\nQ2. Sometimes computers and cash registers in a foodmart are connected to a UPS system. What does UPS mean?");
printf("\nA. United Parcel Service \t B. Uniform Product Support");
printf("\nC. Under Paneling Storage\t D.Uninterruptable Power Supply");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
printf("\n\nWRONG ANSWER!!");
break;
case 'D':
case 'd':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.2,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}

if(ans == 'D' || ans == 'd')
{
getche();
clrscr();
question3();
}

}
void question4();
void question3()
{
clrscr();
fflush(stdin);

printf("Q3.Who is the author of Hamlet?");
printf("\nA. Christopher Marlowe\t B. William Shakespeare");
printf("\nC. Geoffrey Chaucer\\t D. Edith Wharton");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'C':
case 'c':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'B':
case 'b':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.3,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'B' || ans == 'b')
{
getche();
clrscr();
question4();
}

}
void question5();
void question4()
{
clrscr();
fflush(stdin);

printf("Q4.What frequency range is the High Frequency band?");
printf("\nA. 100 kHz\tB. 1GHz");
printf("\nC. 30 to 300 MHz\t D. 3 to 30 MHz");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
printf("\n\nWRONG ANSWER!!");
break;
case 'D':
case 'd':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.5,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'D' || ans == 'd')
{
getche();
clrscr();
question5();
}

}
void question6();
void question5()
{
clrscr();
fflush(stdin);
printf("Q5.What does EPROM stand for?");
printf("\nA. Electric Programmable Read Only Memory\
\n B. Erasable Programmable Read Only Memory")

printf("\n| C. Evaluable Philotic Random Optic Memory \
\n D. Every Person Requires One Mind\t\t\t|");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'C':
case 'c':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'B':
case 'b':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.10,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'B' || ans == 'b')
{
getche();
clrscr();
question6();
}

}
void question7();
void question6()
{
clrscr();
fflush(stdin);
printf("Q6.Which motor is NOT suitable for use as a DC machine?");
printf("\nA. Permanent magnet motor \t B. Series motor");
printf("\nC. Squirrel cage motor \t D. Synchronous motor");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'C':
case 'c':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.25,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'C' || ans == 'c')
{
getche();
clrscr();
question7();
}

}
void question8();
void question7()
{
clrscr();
fflush(stdin);
printf("Q7.Compact discs, (according to the original CD specifications)hold how many minutes of music?");
printf("\nA. 74 mins\t B. 56 mins");
printf("\nC. 60 mins\t D. 90 mins");
scanf("%c",&ans);

switch(ans)
{
case 'B':
case 'b':
case 'C':
case 'c':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'A':
case 'a':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.50,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'A' || ans == 'a')
{
getche();
clrscr();
question8();
}

}
void question9();
void question8()
{
clrscr();
fflush(stdin);
printf("Q8.Who was played by Kenneth Branagh in 'Hamlet' (1996)?");
printf("\n| A. Horatio\t\t |\t B. Laertes\t\t\t|");
printf("\n| C. Polonius\t\t |\t D. Hamlet\t\t\t|");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
printf("\n\nWRONG ANSWER!!");
break;
case 'D':
case 'd':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.1,00,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'D' || ans == 'd')
{
getche();
clrscr();
question9();
}

}
void question10();
void question9()
{
clrscr();
fflush(stdin);
printf("Q9.Which famous national leader of India has written books on the ancient Greek philosopher Socrates and the ancient Roman king Marcus Aurelius?");
printf("\nA. Mahatma Gandhi\t B. Jawaharlal Nehru");
printf("\nC. Bal Gangadhar Tilak\t D. C.Rajagopalachari");
scanf("%c",&ans);
switch(ans)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
printf("\n\nWRONG ANSWER!!");
break;
case 'D':
case 'd':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.10,00,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}
if(ans == 'D' || ans == 'd')
{
getche();
clrscr();
question10();
}

}
void question11();
void question10()
{
clrscr();
fflush(stdin);
printf("\n\nQ10.Sishu is the literary work of which Indian author?");
printf("\nA. Jawaharlal Nehru");
printf("\nB. Arundhati Roy");
printf("\nC. Rabindranath Tagore");
printf("\nD. Vikram Seth \n");
scanf("%c",&ans);

switch(ans)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'C':
case 'c':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.50,00,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}

if(ans == 'C' || ans == 'c')
{
getche();
clrscr();
question11();
}

}
void question11()
{
clrscr();
fflush(stdin);
printf("\n\nQ11.What was the active medium used in the first working laser ever constructed?");
printf("\nA. Helium-neon gas");
printf("\nB. A ruby rod");
printf("\nC. A diamond block ");
printf("\nD. Carbon dioxide gas\n");
scanf("%c",&ans);

switch(ans)
{
case 'A':
case 'a':
case 'C':
case 'c':
case 'D':
case 'd':
printf("\n\nWRONG ANSWER!!");
break;
case 'B':
case 'b':
{
printf("\n\nCORRECT ANSWER!!");
printf("\n\nYOU WON Rs.1,00,00,000!!");
}
break;
default:
printf("\n\nIMPROPER CHOICE!!");
}

if(ans == 'B' || ans == 'b')
{
getche();
clrscr();
gotoxy(30,8);
printf("CONGRATULATIONS!!\n \
\t Thank you!!");
}


Related Links :

Download Turbo C for Windows 7

The C Programming version For Windows 7 in Full Screen Mode


Download Now

Related Links :

Pointer Comparison in C


#include < stdio.h >
int main ()
{
int data[10],i;
int* p1,*p2;
for (i = 0; i <10;i++) { data[i] = i; } p1 = &data [1]; p2 = &data [2]; if (p1 > p2)
{
printf ("p1 is greater than p2\n");
}
else
{
printf ("p2 is greater than p1\n");
}
}



output:p2 is greater than p1

Related Links :

getopt_long Function in C

This function is defined in getopt.h

Syntax:
-------
int *getopt_long* (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *indexptr)

Usage:
------
while (getopt_long (argc, argv, shortopts, longopts, index) != -1) {
}

Related Links :

c program to print the number of digits in a decimal number

#include
int main()
{
int n,count=0,x;
printf("ENter the decimal number\n");
scanf("%d",&n);
x=n;
while(n>0)
{
count++;
n=n/10;
}
printf("Number %d has %d digits\n",x,count);
}






output
ENter the decimal number
2345
Number 2345 has 4 digits

Related Links :

program that converts characters like newline, blank and tab into visible sequence like \n, \b and \t


#include < stdio.h>
#include< conio.h>
#include< string.h>
void main()
{
char str1[100],str2[100];
int i=0,j=0;
clrscr();
printf("Enter the string with blanks,tabs and new line\n");
printf("At the end put full stop.\n");
gets(str1);
while(str1[i]!='.')
{
switch(str1[i])
{
case ' ':
{
str2[j]=';';
j++;
str2[j]='b';
j++;
i++;
break;
}
case '\t':
{
str2[j]=';';
j++;
str2[j]='t';
j++;
i++;
break;
}
case '\n':
{
str2[j]=';';
j++;
str2[j]='n';
j++;
i++;
break;
}
default :
{
str2[j]=str1[i];
j++;
i++;
break;
}
}
}
str2[j]='\0';
for(i=0;i<=strlen(str2);i++)
{
if(str2[i]==';')
printf("\\");
else
printf("%c",str2[i]);
}
getch();
}





Related Links :

C programs on searching word in given array



#include < stdio.h >
#include< conio.h >
void main()
{
char ch;
int blank=1,character=0,line=1;
clrscr();
printf("Enter the string with blanks,tabs and new line\n");
printf("At the end put a full stop.\n");
while(ch!='.')
{
/* read a character from the standard input stream */
ch = getc(stdin);
if(ch==' ')
blank++;
else if(ch=='\n')
line++;
else if(ch!='.')
character++;
}
printf("\nWord %d\nCharacters %d\nLine %d",blank,character,line);
getch();
}




Related Links :

define 2d character array in C programming


#include< stdio.h >
#include< string.h >
void main()
{
char month[12][10];
int i,j;
clrscr();
for(i=0;i< 12;i++)
{
printf("Enter the month name:-");
scanf("%s",&month[i]);
}
printf("Month names are:-\n");
for(i=0;i< 12;i++)
{
j=0;
while(month[i][j]!='\0')
{
printf("%c",toupper(month[i][j]));
j++;
}
printf("\n");
}
getch();
}


Related Links :

C Program to COPY DATA FROM ONE FILE TO ANOTHER File



#include
int main(){
FILE *p,*q;
char file1[20],file2[20];
char ch;
printf("\nEnter the source file name to be copied:");
gets(file1);
p=fopen(file1,"r");
if(p==NULL){
printf("cannot open %s",file1);
exit(0);
}
printf("\nEnter the destination file name:");
gets(file2);
q=fopen(file2,"w");
if(q==NULL){
printf("cannot open %s",file2);
exit(0);
}
while((ch=getc(p))!=EOF)
putc(ch,q);
printf("\nCOMPLETED");
fclose(p);
fclose(q);
return 0;
}

Related Links :

C Program to CONCATENATE (Join) MANY FILES AND STORE THEM IN One FILE IN C


#include
void concatenate(FILE *fp1,FILE *fp2,char *argv[],int argc);
int main(int argc,char *argv[]){
FILE *fp1,*fp2;
concatenate(fp1,fp2,argv,argc);
return 0;
}

void concatenate(FILE *fp1,FILE *fp2,char **argv,int argc){
int i,ch;
fp2=fopen("files","a");
for(i=1;i<=argc-1;i++){
fp1=fopen(argv[i],"r");
while((ch=getc(fp1))!=EOF)
putc(ch,fp2);
}
}

Related Links :

C PROGRAM TO FIND SIZE OF ANY FILE


#include
#include
#include
void main()
{
struct stat status;
FILE *fp;
fp=fopen("test.txt","r");
fstat(fileno(fp),&status);
clrscr();
printf("Size of file : %d",status.st_size);
printf("Drive name : %c",65+status.st_dev);
getch();
}

Related Links :

c program to know read/write Attributes of given file



#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
void main()
{
struct stat status;
FILE *fp;
stat("test.txt",&status);
clrscr();
if (status.st_mode & S_IREAD)
printf("You have read permission.\n");
if (status.st_mode & S_IWRITE)
printf("You have write permission.");
getch();

}

Related Links :

C program to Find the last date of modification date of any file



#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
void main()
{
struct stat status;
FILE *fp;
fp=fopen("test.txt","r");
fstat(fileno(fp),&status);
clrscr();
printf("Last date of modification : %s",ctime(&status.st_ctime));
getch();
}

Related Links :

Program to Find location of file with size,Drive in C


#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
void main()

{
struct stat status;
FILE *fp;
fp=fopen("test.txt","r");
fstat(fileno(fp),&status);
clrscr();
printf("Size of file : %d",status.st_size);
printf("Drive name : %c",65+status.st_dev);
getch();
}

Related Links :

PROGRAM TO REMOVE DUPLICATE ELEMENTS IN AN ARRAY USING C



#include
int main(){
int arr[50];
int *p;
int i,j,k,size,n;
printf("\nEnter size of the array: ");
scanf("%d",&n);
printf("\nEnter %d elements into the array: ",n);
for(i=0;i<=n;i++)
scanf("%d",&arr[i]);
size=n;
p=arr;
for(i=0;i<=size;i++){
for(j=0;j<=size;j++){
if(i==j){
continue;
}
else if(*(p+i)==*(p+j)){
k=j;
size--;
while(k <= size){
*(p+k)=*(p+k+1);
k++;
}
j=0;
}
}
}
printf("\nThe array after removing duplicates is: ");
for(i=0;i <= size;i++){
printf(" %d",arr[i]);
}
return 0;
}

Related Links :

SECOND LARGEST NUMBER IN AN UNSORTED ARRAY USING C PROGRAM




#include
int main(){
int a[50],size,i,big;
printf("\nEnter the size of the array: ");
scanf("%d",&size);
printf("\nEnter %d elements in to the array: ”, size);
for(i=0;i<=size;i++)
scanf("%d",&a[i]);
big=a[0];
for(i=1;i<=size;i++){
if(big<=a[i])
big=a[i];
}
printf("\nBiggest: %d",big);
return 0;
}

Related Links :

C Program to reverse a given string in c



#include
#include
int main(){
char str[50];
char *rev;
printf("Enter any string : ");
scanf("%s",str);
rev = strrev(str);
printf("Reverse string is : %s",rev);
return 0;
}




Related Links :

Program to generate random numbers in c



#include
#include
#include
int main()
{
int num;
randomize();
//Generating the random number
num = random(99999);
//Printing the random number
printf("%d",num);
getch();
return 0;
}



Related Links :

C Program to Search and Remove Duplicate Elements From Given Array



void main()
{
int a[50],i,pos,size;
clrscr();
printf("\n Enter size of An array: ");
scanf("%d",&size);
printf("\n Enter %d elements in to the array: ",size);
for(i=0;i<=size;i++)
scanf("%d",&a[i]);
printf("\n Enter position where to delete: ");
scanf("%d",&pos);
i=0;
while(i!=pos-1)
i++;
while(i<=10)
{
a[i]=a[i+1];
i++;
}
size--;
for(i=0;i<=size;i++)
printf(" %d",a[i]);
getch();
}

Related Links :

C Program to DELETING An ELEMENT FROM Given ARRAY AT DESIRED POSITION




main()
{
int a[50],i,pos,size;
clrscr();
printf("\nEnter size of An array: ");
scanf("%d",&size);
printf("\nEnter %d elements in to An array: ",size);
for(i=0;i<=size;i++)
scanf("%d",&a[i]);
printf("\n Enter the position which is to be delete : ");
scanf("%d",&pos);
i=0;
while(i!=pos-1)
i++;
while(i<=10)
{
a[i]=a[i+1];
i++;
}
size--;
for(i=0;i<=size;i++)
printf(" %d",a[i]);
getch();
}


Related Links :

INSERT AN ELEMENT IN GIVEN ARRAY AT DESIRED POSITION in C Language




#include
int main(){
int a[50],size,num,i,pos,temp;
printf("\n Enter size of An array: ");
scanf("%d",&size);
printf("\nEnter %d elements in to An array: ",size);
for(i=0;iscanf("%d",&a[i]);
printf("\nEnter position and number to insert: ");
scanf("%d %d",&pos,&num);
i=0;
while(i!=pos-1)
i++;
temp=size++;
while(i{
a[temp]=a[temp-1];
temp--;
}
a[i]=num;
for(i=0;iprintf(" %d",a[i]);
return 0;
}


Related Links :

SELECTION SORT Example in C Language ( Sorting Technique)

C Program to show the SELECTION SORT Example. (Sorting Technique)



#include
int main(){
int s,i,j,temp,a[20];
printf("\n Please Enter size of an array :");
scanf("%d",&s);
printf("\nEnter %d elements in to an array:");
for(i=0;i<=s;i++)
scanf("%d",&a[i]);
for(i=0;i<=s;i++){
for(j=i+1;j= if(a[i]>=a[j]){
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
printf("\nThe array after sorting is: ");
for(i=0;i<=s;i++)
printf(" %d",a[i]);
return 0;
}


Related Links :

QUICK SORT Algorithm Program in C

QUICK SORT Algorithm Program in C Language Easy To Sort Numbers...





#include
int main(){
int x[20],size,i;
printf("\nEnter size of the array :");
scanf("%d",&size);
printf("\nEnter %d elements :",size);
for(i=0;i<=size;i++)
scanf("%d",&x[i]);
quicksort(x,0,size-1);
printf("\nSorted elements :");
for(i=0;i<=size;i++)
printf(" %d",x[i]);
return 0;
}

quicksort(int x[10],int first,int last){
int pivot,j,temp,i;
if(first<=last){
pivot=first;
i=first;
j=last;
while(i<=j){
while(x[i]<=x[pivot]&&i i++;
while(x[j]>=x[pivot])
j--;
if(i<=j){
temp=x[i];
x[i]=x[j];
x[j]=temp;
}
}
temp=x[pivot];
x[pivot]=x[j];
x[j]=temp;
quicksort(x,first,j-1);
quicksort(x,j+1,last);
}
}

Related Links :

Program to Find GCD of Given Number by Recursion Function In C Language


#include
int main()
{
int n1,n2,gcd;
printf("\n Enter Any two numbers: ");
scanf("%d %d",&n1,&n2);
gcd=findgcd(n1,n2);
printf("\nGCD of %d and %d is : %d",n1,n2,gcd);
return 0;
}


/*Function Body Starts*/
int findgcd(int x,int y)
{
while(x!=y){
if(x>y)
return findgcd(x-y,y);
else
return findgcd(x,y-x);
}
return x;
}



Related Links :

C Program to Find the power of Given Number using Recursion Function




#include
int main(){
int pow,num;
long int res;
long int power(int,int);
printf("\nEnter a number: ");
scanf("%d",&num);
printf("\nEnter power: ");
scanf("%d",&pow);
res=power(num,pow);
printf("\n%d to the power %d is: %ld",num,pow,res);
return 0;
}
int i=1;
long int sum=1;
long int power(int num,int pow){
if(i<=pow){
sum=sum*num;
power(num,pow-1);
}
else
return sum;
}


Related Links :

Reverse the given Number Using Recursion Function In C




#include
int main(){
int num,rev;
printf("\nEnter a number :");
scanf("%d",&num);
rev=reverse(num);
printf("\nAfter reverse the no is :%d",rev);
return 0;
}

int sum=0,r;
reverse(int num){
if(num){
r=num%10;
sum=sum*10+r;
reverse(num/10);
}
else
return sum;
return sum;
}





Method 2


#include "stdio.h"

int reverse(int,int );

void main()
{
int no,rev=0;
printf("Enter a number..\n");
scanf("%d",&no);
printf("The reversed number is %d.\n",reverse(no,rev));
}

int reverse(int no,int rev)
{
if(no!=0)
return reverse(no/10,rev*10+no%10);
else
return rev;
}






Method 3



#include
main()
{
int a,i,n,b;
printf("Enter the no:");
scanf("%d",&a);
while(a)
{
b=a%10;
printf("%d",b);
a=a/10;
}
}


Related Links :

CONCATENATION (Joining) OF TWO Different Strings USING Pointers In C Language


#include
int main()
{
int i=0,j=0;
char *str1,*str2,*str3;
puts("Enter first string");
gets(str1);
puts("Enter second string");
gets(str2);
printf("Before concatenation the strings are\n");
puts(str1);
puts(str2);
while(*str1)
{
str3[i++]=*str1++;
}
while(*str2)
{
str3[i++]=*str2++;
}
str3[i]='\0';
printf("After concatenation the strings are\n");
puts(str3);
return 0;
}



Related Links :

LINEAR SEARCH Example in C Language


#include
int main(){
int a[10],i,n,m,c=0;
printf("Enter the size of an array");
scanf("%d",&n);
printf("\nEnter the elements of the array");
for(i=0;i<=n-1;i++){
scanf("%d",&a[i]);
}
printf("\nThe elements of an array are");
for(i=0;i<=n-1;i++){
printf(" %d",a[i]);
}
printf("\nEnter the number to be search");
scanf("%d",&m);
for(i=0;i<=n-1;i++){
if(a[i]==m){
c=1;
break;
}
}
if(c==0)
printf("\nThe number is not in the list");
else
printf("\nThe number is found");
return 0;
}



Related Links :

BINARY SEARCH Example in C Language


#include
int main()
{
int a[10],i,n,m,c=0,l,u,mid;
printf("Enter the size of an array->");
scanf("%d",&n);
printf("\nEnter the elements of the array->");
for(i=0;i {
scanf("%d",&a[i]);
}
printf("\nThe elements of an array are->");
for(i=0;i {
printf(" %d",a[i]);
}
printf("\nEnter the number to be search->");
scanf("%d",&m);
l=0,u=n-1;
while(l<=u)
{
mid=(l+u)/2;
if(m==a[mid])
{
c=1;
break;
}
else if(m<=a[mid])
{
u=mid-1;
}
else
l=mid+1;
}
if(c==0)
printf("\nThe number is not in the list");
else
printf("\nThe number is found");
return 0;
}



Related Links :

C PROGRAM BINARY SEARCH THROUGH RECURSSION Function


#include
int main(){
int a[10],i,n,m,c,l,u;
printf("Enter the size of an array =>");
scanf("%d",&n);
printf("\nEnter the elements of an array =>");
for(i=0;i scanf("%d",&a[i]);
}
printf("\nThe elements of an array are =>");
for(i=0;i printf(" %d",a[i]);
}
printf("\nEnter the number to be search =>");
scanf("%d",&m);
l=0,u=n-1;
c=binary(a,n,m,l,u);
if(c==0)
printf("\nThe number is not in the list");
else
printf("\nThe number is found");
return 0;
}

int binary(int a[],int n,int m,int l,int u)
{
int mid,c=0;
if(l<=u){
mid=(l+u)/2;
if(m==a[mid])
{
c=1;
}
else if(m<=a[mid])
{
return binary(a,n,m,l,mid-1);
}
else
return binary(a,n,m,mid+1,u);
}
else
return c;
}



Related Links :

c program to find factorial of 100 or very large numbers Given by User In C

c program to find factorial of 100 or very large numbers Given by User in C



#include
#define MAX 10000
void factorialof(int);
void multiply(int);
int length = 0;
int fact[MAX];

int main(){
int num;
int i;

printf("Enter any integer number : ");
scanf("%d",&num);

fact[0]=1;

factorialof(num);

printf("Factorial is : ");
for(i=length;i>=0;i--)
{
printf("%d",fact[i]);
}
return 0;
}
void factorialof(int num)
{
int i;
for(i=2;i<=num;i++)
{
multiply(i);
}
}
void multiply(int num)
{
long i,r=0;
int arr[MAX];
for(i=0;i<=length;i++)
{
arr[i]=fact[i];
}

for(i=0;i<=length;i++){
fact[i] = (arr[i]*num + r)%10;
r = (arr[i]*num + r)/10;
//printf("%d ",r);
}
if(r!=0){
while(r!=0){
fact[i]=r%10;
r= r/10;
i++;
}
}
length = i-1;
}



Related Links :

TEST

Get your potbellied pig to mate

Related Links :

Scope Resolution in C++


namespace X {
class Y {
static int i;
public:
void f();
};
class Z;
void func();
}
int X::Y::i = 9;
class X::Z {
int u, v, w;
public:
Z(int i);
int g();
};
X::Z::Z(int i) { u = v = w = i; }
int X::Z::g() { return u = v = w = 0; }
void X::func() {
X::Z a(1);
a.g();
}
int main(){} ///:~


Related Links :

Basic Program to create Rectangle in Cpp




class Rectangle {
int width, height;
public:
Rectangle(int w = 0, int h = 0)
: width(w), height(h) {}
int getWidth() const { return width; }
void setWidth(int w) { width = w; }
int getHeight() const { return height; }
void setHeight(int h) { height = h; }
};

int main() {
Rectangle r(19, 47);
// Change width & height:
r.setHeight(2 * r.getWidth());
r.setWidth(2 * r.getHeight());
} ///


Related Links :

C Program to create a calendar for DOS

 


#include
#include
#include "scaldate.h"

/*
** calendar generation information
*/

int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char *month[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
char *daynames[8] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};

/*
** box drawing stuff
*/

#if defined(MSDOS) || defined(_WIN32)
const char *topborder = "\xd5\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
"\xcd\xcd\xcd\xcd\xb8";
const char *midborder = "\xc6\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
"\xcd\xcd\xcd\xcd\xb5";
const char *botborder = "\xd4\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
"\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
"\xcd\xcd\xcd\xcd\xbe";
const char *line = "\xb3";
#else
const char *line = "";
#endif

/*
** tell 'em they messed up
*/

void usage(void)
{
puts("Usage: CAL [m y]");
puts("where: m = month (1 - 12)");
puts(" y = year (1 - 99, 1800 - 3000)");
exit(-1);
}

/*
** here's where the real work's done
*/

int main(int argc, char *argv[])
{
int day, day_1, numdays, i, j;
unsigned yr, mo;

if (argc < 3 && argc > 1)
usage();

if (argc >= 3)
{
yr = atoi(argv[2]);
mo = atoi(argv[1]);
}
else
{
long dnow = today();
unsigned dy;

scalar_to_ymd(dnow, &yr, &mo, &dy);
}

if (!mo || 12 < mo)
usage();

if (100 > yr)
yr += 1900;

if (3000 < yr || 1800 > yr)
usage();

for (i = 0, mo -= 1; i < 3; ++i, ++mo)
{
if (!mo)
{
mo = 12;
--yr;
}
if (12 < mo)
{
mo = 1;
++yr;
}
numdays = days[mo - 1];
if (2 == mo && isleap(yr))
++numdays;
day_1 = (int)((ymd_to_scalar(yr, mo, 1) - (long)ISO_CAL) % 7L);

#if defined(MSDOS) || defined(_WIN32)
if (!i)
puts(topborder);
#endif
fputs(line, stdout);
for (j = 0; j < 7; )
{
fputs(daynames[ISO_CAL + j], stdout);
if (7 != ++j)
fputc(' ', stdout);
}
printf("%s < %s, %d\n%s", line, month[mo - 1], yr, line);

for (day = 0; day < day_1; ++day)
fputs(" ", stdout);
for (day = 1; day <= numdays; ++day, ++day_1, day_1 %= 7)
{
if (!day_1 && 1 != day)
printf("\b%s\n%s", line, line);
printf("%3d ", day);
}
for ( ; day_1; ++day_1, day_1 %= 7)
fputs(" ", stdout);
#if defined(MSDOS) || defined(_WIN32)
printf("\b%s\n", line);
if (2 > i)
puts(midborder);
else puts(botborder);
#else
fputc('\n', stdout);
#endif
}
return 0;
}



Related Links :

C Program to reverse the given string


#include /* Prototypes for standard Input/Output */
#include /* Prototypes for string operations */

void forward_and_backwards(char line_of_char[], int index);

int main()
{
char line_of_char[80];
int index = 0;

strcpy(line_of_char, "This is a string.\n");

forward_and_backwards(line_of_char, index);

return 0;
}


void forward_and_backwards(char line_of_char[], int index)
{
if (line_of_char[index])
{
printf("%c", line_of_char[index]);
index++;
forward_and_backwards(line_of_char, index);
}
printf("%c", line_of_char[index]);
}







/* OUTPUT :


This is a string.

.gnirts a si sih

*/

Related Links :

C Program to create a file by user defined name enter



#include
#include

int main()
{
FILE *fp1;
char oneword[100], filename[25];
char *c;

printf("Enter filename -> ");
scanf("%s", filename); /* read the desired filename */
fp1 = fopen(filename, "r");
if (fp1 == NULL)
{
printf("File failed to open\n");
exit (EXIT_FAILURE);
}

do
{
c = fgets(oneword, 100, fp1); /* get one line from the file */
if (c != NULL)
printf("%s", oneword); /* display it on the monitor */
} while (c != NULL); /* repeat until NULL */

fclose(fp1);

return EXIT_SUCCESS;
}


Related Links :

Compute the checksum of a file in C



#include

unsigned checksum(void *buffer, size_t len, unsigned int seed)
{
unsigned char *buf = (unsigned char *)buffer;
size_t i;

for (i = 0; i < len; ++i)
seed += (unsigned int)(*buf++);
return seed;
}

#ifdef TEST

#include

main()
{
FILE *fp;
size_t len;
char buf[4096], *file = "CHECKSUM.C";

if (NULL == (fp = fopen(file, "rb")))
{
printf("Unable to open %s for reading\n", file);
return -1;
}
len = fread(buf, sizeof(char), sizeof(buf), fp);
printf("%d bytes read\n", len);
printf("The checksum of %s is %#x\n", file, checksum(buf, len, 0));
}

#endif




Related Links :

concatenate files using CAT function in C


#include

main(argc, argv) /* cat: concatenate files */
int argc;
char *argv[];
{
FILE *fp, *fopen();

if (argc == 1) /* no args; copy standard input */
filecopy(stdin);
else
while (--argc > 0)
if ((fp = fopen(*++argv, "r")) == NULL) {
fprintf(stderr,
"cat: can't open %s\n", *argv);
exit(1);
} else {
filecopy(fp);
fclose(fp);
}
exit(0);
}

filecopy(fp) /* copy file fp to standard output */
FILE *fp;
{
int c;

while ((c = getc(fp)) != EOF)
putc(c, stdout);
}





Related Links :

convert value of string s in double/float format and store in val. return pointer to next unused char



#include "defs.h"
#include "stdtyp.h"
#include "mathcons.h"
#include "mathtyp.h"
#include "ctype.h"

/************************************************************************/
STRING
astof(s, val) /* convert value of string s in double/float format and
store in val. return pointer to next unused char. */
/*----------------------------------------------------------------------*/
STRING s;
double *val;
{
STRING astoi();
double v, fr, tenpow();
int i;
BOOL sign;
char c;

while (isspace(c = *s))
s++;
if (sign = (c IS '-'))
s++;
else if (c IS '+')
s++;
for (v = 0.0; isdigit(*s); v = 10. * v + (*s++ - '0'));
if (*s IS '.')
for (fr = 10.0, s++; isdigit(*s); fr *= 10.)
v += (*s++ - '0') / fr;
while (isspace(*s))
s++;
if (TOLOWER(*s) IS 'e')
{ if ((i = ((c = *(++s)) IS '-')) OR c IS '+')
s++;
while (*s IS '0')
s++;
if (i)
*(--s) = '-';
s = astoi(s, &i);
v *= tenpow(i);
}
*val = (sign ? -v : v);
return (s);
}
/*\p*********************************************************************/
double
atof(s) /* return value of the string s in double/float format */

/*----------------------------------------------------------------------*/
STRING s;
{
double x;
STRING astof();

astof(s, &x);
return x;
}

/************************************************************************/
LOCAL double
tenpow(n) /* Return 10.0^n, or -1 on error. */

/*----------------------------------------------------------------------*/
{
/********************************************************
* This array contains 10^(2^n) up to n = BIG10X-1 *
********************************************************/
LOCAL double tentothe2tothe[BIG10X] =
{ 10., 100., 10000., 100000000., 10000000000000000.,
100000000000000000000000000000000.
#ifdef AZTEC
, 1.0e64, 1.0e128
#endif

#ifdef SUN
, 1.0e64, 1.0e128, 1.0e256
#endif
};

/********************************************************
* Also, make this array be 2^n up to 2^(BIG10X-1) *
********************************************************/
LOCAL int twoto[BIG10X] =
{ 1, 2, 4, 8, 16, 32
#ifdef AZTEC
, 64, 128
#endif

#ifdef SUN
, 64, 128, 256
#endif
};

int i, minus;
double d;

if (minus = (n < 0) ? TRUE : FALSE)
n = -n;
for (d = 1.0, i = BIG10X; --i >= 0; )
if (n >= twoto[i])
{ d *= tentothe2tothe[i];
n -= twoto[i];
}
return (minus) ? 1.0 / d : d;
}


Related Links :

arcsine unction demo in c




#include "math.h"
#include "errno.h"

double arcsine();

double asin(x)
double x;
{
return arcsine(x,0);
}

double acos(x)
double x;
{
return arcsine(x,1);
}

#define P1 -0.27368494524164255994e+2
#define P2 +0.57208227877891731407e+2
#define P3 -0.39688862997504877339e+2
#define P4 +0.10152522233806463645e+2
#define P5 -0.69674573447350646411
#define Q0 -0.16421096714498560795e+3
#define Q1 +0.41714430248260412556e+3
#define Q2 -0.38186303361750149284e+3
#define Q3 +0.15095270841030604719e+3
#define Q4 -0.23823859153670238830e+2

#define P(g) ((((P5*g P4)*g P3)*g P2)*g P1)
#define Q(g) (((((g Q4)*g Q3)*g Q2)*g Q1)*g Q0)

double arcsine(x,flg)
double x;
{
double y, g, r;
register int i;
extern int errno;
static double a[2] = { 0.0, 0.78539816339744830962 };
static double b[2] = { 1.57079632679489661923, 0.78539816339744830962 };

y = fabs(x);
i = flg;
if (y < 2.3e-10)
r = y;
else {
if (y > 0.5) {
i = 1-i;
if (y > 1.0) {
errno = EDOM;
return 0.0;
}
g = (0.5-y)+0.5;
g = ldexp(g,-1);
y = sqrt(g);
y = -(y+y);
} else
g = y*y;
r = y + y*
((P(g)*g)
/Q(g));
}
if (flg) {
if (x < 0.0)
r = (b[i] + r) + b[i];
else
r = (a[i] - r) + a[i];
} else {
r = (a[i] + r) + a[i];
if (x < 0.0)
r = -r;
}
return r;
}




Related Links :

a simple function using all ANSI-standard functions to determine the size of a file



#include

long flength(char *fname)
{
FILE *fptr;
long length = -1L;

fptr = fopen(fname, "rb");
if(fptr != NULL)
{
fseek(fptr, 0L, SEEK_END);
length = ftell(fptr);
fclose(fptr);
}

return length;
}

#ifdef TEST

main(int argc, char *argv[])
{
printf("Length of %s = %ld\n", argv[0], flength(argv[0]));
return 0;
}

#endif /* TEST */



Related Links :

Allocates a multidimensional array dynamically, at runtime in C


/*

AMALLOC - multi-dimensional malloc()

Allocates a multidimensional array dynamically, at runtime, so that
1: its elements can be accessed using multiple indirection
2: it can be deallocated using a call to the standard free() function
Note: On PC's the max array size is 64K

Paul Schlyter, 1992-02-09. Released to the public domain.

*/


#include
#include
#include


#define MAXDIMS 5 /* Defines the maximum number of dimensions */
#define MAXSIZE ((size_t) -1L) /* Maximum size of array */


void *amalloc( int esiz, void *initval, int dims, ... )
/*
* Input: esiz size of each array elements, as given by sizeof
* initval pointer to initial value. NULL ==> zero fill
* dims number of dimensions: 1..MAXDIMS (5)
* ... number of elements in each dimension (int's)
*
* Returns: NULL error: out of memory, or illegal parameters
* otherwise base pointer to array
*/
{
unsigned int dim[MAXDIMS], accdim[MAXDIMS];
va_list ap;
int i, j;
long int totsiz;
void **q;
char *p, *r, *s;

if (dims < 1 || dims > MAXDIMS)
return NULL;

memset(dim, 0, sizeof(dim)); /* Read dimension numbers */
memset(accdim, 0, sizeof(accdim));
va_start(ap, dims);
dim[0] = accdim[0] = va_arg(ap,int);
for (i = 1; i < dims; i++)
{
dim[i] = va_arg(ap,int);
accdim[i] = accdim[i-1] * dim[i];
}
va_end(ap);

/* Compute total array size */
totsiz = esiz * accdim[dims-1]; /* Data size */

for (i = 0; i < dims - 1; i++ ) /* Add space for pointers */
totsiz += sizeof(void *) * accdim[i];

if (totsiz > MAXSIZE) /* Exit if totsiz too large */
return NULL;

p = malloc((size_t) totsiz); /* Allocate memory */
if (p == NULL) /* Out-of-memory */
return NULL;
memset(p, 0, (unsigned int) totsiz); /* Zero out allocated memory */
q = (void **) p;

if (dims == 1)
r = (char *) q + esiz * accdim[0];

for (i = 1; i < dims; i++) /* Fill in pointers */
{
int siz;
int accd = accdim[i-1], d = dim[i];

siz = i == dims-1 ? esiz : sizeof(void *);

r = (char *) q + sizeof(void *) * accd;
for (j = 0; j < accd; j++)
{
*q++ = r;
r += siz * d;
}
}

if (initval != NULL)
{
for (s = (char *) q; s < r; s += esiz)
memcpy(s, initval, esiz);
}

return p;

} /* amalloc */


#ifdef TEST /* Test program */

#include

main()
{
static char init_d[8] = { 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF };
int init_i = 0x1111;
double *a = amalloc( sizeof(double), init_d, 1, 4 );
double **b = amalloc( sizeof(double), init_d, 2, 4, 5 );
double ***c = amalloc( sizeof(double), init_d, 3, 4, 5, 6 );
int ***d = amalloc( sizeof(int), &init_i, 3, 4, 5, 6 );
int i, j, k;

for (i = 0; i < 4; i++)
for (j = 0; j < 5; j++ )
for (k = 0; k < 6; k++ )
d[i][j][k] = (i * 256) + (j * 16) + k;

a = a, b = b, c = c;

return 0;
}

#endif



Related Links :


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!