Oct 21, 2012 at 7:23am UTC
can anyone help me convert the words in this C program code.. to C++ code.. like for example.. the code "printf" for C ++ is "cout << " how about scanf and the likes? please help me :D
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
char a[40],t;
int i,j;
clrscr();
printf("\n Enter the String :- ");
scanf("%s",a);
for(i=0;a[i]!='\0';i++)
{
for(j=i+1;a[j]!='\0';j++)
{
if(a[i]>a[j])
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
printf("the alphabet wise is :- %s",a);
getch();
}
Oct 21, 2012 at 9:36am UTC
ohh.. thank you very much :D
Oct 21, 2012 at 9:45am UTC
How about if I need to make it ..... the program will have a subject to change / variable it would become like this.
Output:
Enter the number of words you wanted to put : 3
mouse
cat
dog
Sorted Alphabetically is :
cat
dog
mouse