The prog code:
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;string.h%26gt;
#define max 1000
#define IN 1
#define OUT 0
int findindex(char *);
void rem_new(char *);
void classification1(char *,int);
void classification5(char *,int);
void searchpost(char *,char,char *);
void searchpre(char *,char,char *);
FILE *in, *out;
    char Non_polar[]={'G','A','V','L','I','P','M'...
    char Polar[]={'S','T','N','Q','C','Y','\0'};
    char Acidic[]={'D','E','\0'};
    char Basic[]={'K','R','H','\0'};
    char previous,next;
    int pre=0,post=1;
    int previous_flag=0,next_flag=0;
    char arrayprevious[15],arraynext[15];
    char infile[20]="",outfile[20]="";
    char class5[8][12]={ {'V','I','L','\0'},
              {'A','G','S','T','\0'},
              {'P','N','D','V','A','G','S','T','\0'},
              {'F','Y','W','H','\0'},
              {'A','G','V','I','L','M','F','Y','W','H'...
              {'D','E','K','H','R','\0'},
              {'S','T','N','D','Y','K','E','W','H','R'...
              {'H','K','R','\0'},
            };
    char
fullname[][20]={"Aliphatic","Tiny","Sm...
    char previous1,previous2,next1,next2;
int main(void)
{
  char *name,*seq,*tmp;
  char *ptr;
  int ch,flag=OUT;
  char *blank="-";
  int k=0,k1=0;
   clrscr();
   name=((char *)malloc(1000*sizeof(char)));
   seq=((char *)malloc(5000*sizeof(char)));
   tmp=((char *)malloc(1000*sizeof(char)));
   if(name==NULL||seq==NULL||tmp==NULL)
   {
    printf("Desired Memory has not been allocated; exiting\n");
    exit(1);
   }
   printf("Enter the name of input file\n");
   scanf("%s",infile);
   printf("Enter the name of output file\n");
   scanf("%s",outfile);
       if ((in = fopen(infile, "r"))== NULL)
         {
        printf("Cannot open input file.\n");
        return 1;
         }
       if ((out = fopen(outfile, "w+"))== NULL)
        {
        printf("Cannot open output file.\n");
        return 1;
        }
           strcpy(name,"");
           strcpy(seq,"");
           strcpy(tmp,"");
         while ((ch=fgetc(in))!=EOF)
        {
               if( ch!='%26gt;')
            {
                   ungetc(ch,in);
                   fgets(tmp,max,in);
                   strcat(seq,tmp);
                   flag=IN;
            }
            else if (flag==IN)
                 {
                 rem_new(seq);
                 k=findindex(seq);
                 flag=OUT;
                 strcpy(seq,"");
                 ungetc(ch,in);
                 }
            else  {
                fgets(name,max,in);
                ptr=strtok(name," ");
                fprintf(out,"%s",ptr);
                ptr=strtok(NULL,"[");
                ptr=strtok(NULL,"]");
                if (ptr==NULL)
                fprintf(out,"\t%8s\t",blank);
                else
                fprintf(out,"\t%s\t",ptr);
                fprintf(out,"Location\tPattern\tOne Residue
Classification\t\t\tPattern\tTwo Residue Classification\n");
                 }
        }
        if (flag==IN)
            {
             rem_new(seq);
             k1=findindex(seq);
             flag=OUT;
             strcpy(seq,"");
            }
           fclose(in);
           fclose(out);
           free(name);
           free(tmp);
           free(seq);
     return 0;
    }
int findindex(char *seq)
    {
    int i=0,j=0,count=0;
    for(i=0;seq[i]!='\0';i++)
        {
        j=i;
        if(seq[j]=='K')
            {
            count++;
            fprintf(out,"\t");
            fprintf(out,"   \t");
            fprintf(out,"%d K %d  \t",count,j+1);
            classification1(seq,j);
            fprintf(out,"%s | K | %s\t\t\t",arrayprevious,arraynext);
            strcpy(arrayprevious,"");
            strcpy(arraynext,"");
            previous_flag=0;
            next_flag=0;
            classification5(seq,j);
            }
        }
    return j;
    }
void rem_new(char *seq)
    {
    int i=0,j=0;
    for(i=0;seq[i]!='\0';i++)
            {
            if (seq[i]=='\n')
                {
                j=i;
                while(seq[j]!='\0')
                {
                seq[j]=seq[j+1];
                j++;
                }
                seq[j]='\0';
                }
            }
    }
void classification1(char *seq,int k)
    {
    previous=seq[k-1];
    next=seq[k+1];
    if(k==0)
    previous='\b';
        fprintf(out,"%cK%c\t",previous,next);
        searchpre(Non_polar,previous,"Non-polar"...
        searchpre(Polar,previous,"Polar");
        searchpre(Acidic,previous,"Acidic");
        searchpre(Basic,previous,"Basic");
        searchpost(Non_polar,next,"Non-polar");
        searchpost(Polar,next,"Polar");
        searchpost(Acidic,next,"Acidic");
        searchpost(Basic,next,"Basic");
    }
void searchpre(char *arr,char value,char *name)
    {
    int i;
            if(previous_flag==0)
                {
                for(i=0;arr[i]!='\0';i++)
                    if(arr[i]==value)
                    {
                    previous_flag=1;
                    strcpy(arrayprevious,name);
                    break;
                    }
                }
    }
void searchpost(char *arr,char value,char *name)
    {
    int i;
            if(next_flag==0)
                {
                for(i=0;arr[i]!='\0';i++)
                    if(arr[i]==value)
                    {
                    next_flag=1;
                    strcpy(arraynext,name);
                    break;
                    }
                }
    }
void classification5(char *seq,int k)
    {
    int i,j,c1=0,c2=0,c3=0,c4=0,count1=0,count2=...
    int index1[15],index2[15],index3[15],index4[...
    int preindex[11],postindex[11];
    previous1=seq[k-1];
    previous2=seq[k-2];
    next1=seq[k+1];
    next2=seq[k+2];
    if(k==0)
    {
    previous1='\b';
    previous2='\b';
    }
    if(k==1)
    {
    previous2='\b';
    }
    fprintf(out,"%c%cK%c%c\t",previous2,prev...
    for(i=0;i%26lt;8;i++)
        for(j=0;class5[i][j]!='\0';j++)
            {
            if(class5[i][j]==previous1)
                index1[c1++]=i;
            if(class5[i][j]==previous2)
                index2[c2++]=i;
            if(class5[i][j]==next1)
                index3[c3++]=i;
            if(class5[i][j]==next2)
                index4[c4++]=i;
            }
            for(i=0;i%26lt;c1;i++)
                for(j=0;j%26lt;c2;j++)
                if(index1[i]==index2[j])
                preindex[count1++]=index1[i];
            for(i=0;i%26lt;c3;i++)
                for(j=0;j%26lt;c4;j++)
                if(index3[i]==index4[j])
                postindex[count2++]=index3[i];
                if ((count1==0)%26amp;%26amp;(count2==0))
                    fprintf(out,"* |K| *");
                else if ((count1==0)%26amp;%26amp;(count2!=0))
                    for(i=0;i%26lt;count2;i++)
                    fprintf(out,"* |K| %s
%s,",fullname[postindex[i]],fullname[p...
                else if ((count1!=0)%26amp;%26amp;(count2==0))
                    for(i=0;i%26lt;count1;i++)
                    fprintf(out,"%s %s |K|
*,",fullname[preindex[i]],fullname[pre...
            for(i=0;i%26lt;count1;i++)
                for(j=0;j%26lt;count2;j++)
                   fprintf(out,"%s %s |K| %s
%s,",fullname[preindex[i]],fullname[pr...
                   fprintf(out,"\n");
    }
I have a C# program and want some1 to fix the syntax errors in it. Plz send the error free version!Thanks!?
I'd dump it into a compiler and do it for you but you left too much out.  Impossible to return a syntax error free version without the whole program.
Anyways, I get paid for this.  How many points is this worth?  ...to do someone's homework for him?  Or maybe he's doing contract work!  He's getting $70 and hour to let us do it for him!
Reply:pal open the program in C# editor which provides compilation facility also. when u compile the program it will show u the list of syntax errors. click on the error and it will take u to the location where the error is occuring. u will b able to fix it on urself. and remember Syntax errors are the easiest errors to fix as they are grammatical errors for the programming language. b brave and do it urself u can do it...come on...
Reply:What? You don't have a syntax highlighter and a good debugger?
Get real.
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment