C PROGRAM
/*Following is a code to find all the possible combinations of the characters of a string ,but it's not giving correct result due do some mistake.Please help
Input - no of characters in string and the string.
Output - all the combinations of characters of the string.
for e.g.
Sample Input :
enter the number of characters in the word you are going to enter 2
enter the word: os
Output(it will be stored in a text file) :
o
s
oo
os
so
ss
*/
#include <stdio.h>
#include <string.h>
int m=0;
void pos(char *a,char *b,int j,int n,FILE *fp,int k);
main()
{ File *fp;
fp=fopen("possibilities.txt","r");
char *a,*b;
int n,j,k;
printf("\nenter the number of characters in the word you are going to enter ");
scanf("%d ",&n);
a=(char*)malloc(n+1 *sizeof(char));
printf("\nenter the word: ");
scanf("%s ",a);
a[n]='\0';
for(k=1;k<n;k++)
{
b=(char*)malloc(k+1 *sizeof(char));
b[k]='0';
pos(a,b,0,n,fp,k);
}
print
1
Expert's answer
2012-10-26T10:30:19-0400
Unfortunately, your question requires a lot of work and cannot be done for free. Submit it with all requirements as an assignment to our control panel and we'll assist you.
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment