Saturday, 9 May 2009

Arrange the name in alphabetical order

Description:-
If u want to arrange ur name & others name in the alphabetical order then this is the program which will help u to do that job very well.

For example if u give the following names in the order:-
a)santanu
b)arnab
c)biswajit
d)sourav
e)joy
f)agni
The output will be:-

a)agni
b)arnab
c)biswajit
d)joy
e)santanu
f)sourav

-:Screen shots:-




Process:-
1. Copy the entire source code(Bold in format).
2. Paste that in your c or c++ compiler.
3. Save that with a suitable name.
4. Compile that program.
5. Finally run that program.

Error handling:-
Due to inappropiate html coding done by this web page I can't give the header file
name like stdio.h, conio.h, stdlib.h, iostream.h, fstream.h, iomanip.h etc.
If u get an error report after compiling the program
"CALL TO UNDEFINED FUNCTION 'PRINTF(OR ANYTHING)' IN FUNCTION MAIN()"
please add the above mentioned header file after #include
like #include.

Disclaimer:-
If you have any other problem regarding the program please mail me.
My mail address is showing on my blog page.


Source code:-

#include
#include
#include
void reorder(int n,char x[][12]);
main()
{
int i,n=0;
char x[100][12];
printf("Enter each name in a single line\n\n");
printf("Type 'end' when finished\n\n'");
do
{
printf("string %d: ",n+1);
scanf("%s",x[n]);
}
while(strcmp(x[n++],"end"));
n--;
reorder(n,x);
for(i=0;i printf("\nstring %d: %s",i+1,x[i]);
}
void reorder(int n,char x[][12])
{
char temp[12];
int i,item;
for(item=0;item {
for(i=item+1;i {
if(strcmp(x[item],x[i])>0)
{
strcpy(temp,x[item]);
strcpy(x[item],x[i]);
strcpy(x[i],temp);
}
}
}
return;
}

Friday, 8 May 2009

Binary

Description:-
Enter the decimal number & this program gives u the binary equivalent number of that given decimal number.
For example:-
Enter the decimal number=2654
Binary equivalent=>
101001011110

Process:-
1. Copy the entire source code(Bold in format).
2. Paste that in your c or c++ compiler.
3. Save that with a suitable name.
4. Compile that program.
5. Finally run that program.

Error handling:-
Due to inappropiate html coding done by this web page I can't give the header file
name like stdio.h, conio.h, stdlib.h, iostream.h, fstream.h, iomanip.h etc.
If u get an error report after compiling the program
"CALL TO UNDEFINED FUNCTION 'PRINTF(OR ANYTHING)' IN FUNCTION MAIN()"
please add the above mentioned header file after #include
like #include.

Disclaimer:-
If you have any other problem regarding the program please mail me.
My mail address is showing on my blog page.


Source code:-

#include
void main()
{
int x[100],i=0;
long n;
printf("Enter the number=>");
scanf("%ld",&n);
printf("\nBinary equivalent=>\n\n");
while(n!=0)
{
x[i]=n%2;
i++;
n=n/2;
}
for(n=(i-1);n>=0;n--)
printf(" %d ",x[n]);
}



Get the abbreviated form

Description:-
If u tired to make ur name in the abbreviated form here is the simple solution of this problem. Through this program u can convert any English name into the abbreviated format. For example if ur name is "Santanu biswas" then the program returns "S biswas"; also if your name is "Sunil kumar ghosh" then the program returns "S k ghosh".

Process:-
1. Copy the entire source code(Bold in format).
2. Paste that in your c or c++ compiler.
3. Save that with a suitable name.
4. Compile that program.
5. Finally run that program.

Error handling:-
Due to inappropiate html coding done by this web page I can't give the header file
name like stdio.h, conio.h, stdlib.h, iostream.h, fstream.h, iomanip.h etc.
If u get an error report after compiling the program
"CALL TO UNDEFINED FUNCTION 'PRINTF(OR ANYTHING)' IN FUNCTION MAIN()"
please add the above mentioned header file after #include
like #include.

Disclaimer:-
If you have any other problem regarding the program please mail me.
My mail address is showing on my blog page.



Source code:-

#include
#include
void main()
{
int i,n,len;
char name[50];
printf("Enter the name(Firstname Middlename Lastname)=>");
gets(name);
len=strlen(name);
n=len-1;
while(name[n]!=' ')
n--;
for(i=0;i {
if(i==0)
printf("%c ",name[i]);
else if(name[i]==' ')
printf("%c ",name[i+1]);
}
for(i=n+1;i printf("%c",name[i]);
}