Beispiel #1
0
void reverse(char s[])
{
    void reverser(int begin,int end,char s[]);

    int len=strlen(s);
    reverser(0,len-1,s);
}
Beispiel #2
0
 LabeledDirectedGraph<GRAPHEDGE> graph_reverse(const LabeledDirectedGraph<GRAPHEDGE>& g)
 {
   LabeledDirectedGraph<GRAPHEDGE> g_rev = LabeledDirectedGraph<GRAPHEDGE>();
   GraphReverser<GRAPHEDGE> reverser(g_rev);
   graph_transform(g,reverser);
   return g_rev;
 }
Beispiel #3
0
main()
{
	char s[MAXLINE];
	
	while(getline(s, MAXLINE) > 0) {
		reverser(s, 0, strlen(s));
		printf("%s", s);
	}
}
Beispiel #4
0
void reverser(char s[], int i, int len)
{
	int c, j;
	j = len - (i + 1);
	if (i < j) {
		c = s[i];
		s[i] = s[j];
		s[j] = c;
		reverser(s, ++i, len);
	}
}
Beispiel #5
0
int main( int argc, char* argv[] ) 
{   
	std::string faa_file;
	std::string ffn_file;
	std::string place_file;
	std::string out_dir;
    int ncpus = 1;
    int gap_ext = GAP_EXT;
    int gap_open = GAP_OPEN;
    // int lower_band = LOWER_BAND;
    // int upper_band = UPPER_BAND;
    double band_ratio = BAND_RATIO;
    bool banded    = false;
    bool align     = false;
    bool profile   = false;
	bool verbose   = false;

    args::parse_cmd_args_postspa( argc, 
                                  argv, 
                                  faa_file,
                                  ffn_file,
                                  place_file,
                                  out_dir,
                                  ncpus,
                                  gap_ext,
                                  gap_open,
                                  //lower_band,
                                  //upper_band,
                                  band_ratio,
                                  banded,
                                  align,
                                  profile,
                                  verbose );

    args::printCommand(argc, argv, std::cout); 

    Reverser reverser( ffn_file, faa_file, place_file, out_dir, ncpus, align, profile, verbose );
    
    reverser.setGapPenalties( gap_ext, gap_open );

    if ( banded ) {
        reverser.setBandedAlignment(true);
        //reverser.setAlignmentBands( lower_band, upper_band );
        reverser.setBandRatio( band_ratio );
    }

    reverser.run();

    return 0;
}
Beispiel #6
0
void reverser(int begin,int end,char s[])
{
    char temp;
    int i=begin;
    int j=end;
 //   static int i=0;
 //   static int j=len;
    printf("j is %d\n",j);
    if(i<j)
    {
        temp=s[i];
        s[i++]=s[j];
        s[j--]=temp;
        reverser(i,j,s);
    }
    printf("%d--%d\n",i,j);
} 
Beispiel #7
0
/* 主函数 */
int main (int argc, char *argv[])
{
    char str[BUF_SIZE] = { 0 };
    int ret = OK;

    int i = 0;

    strcpy (str, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");

    printf ("original string : %s \r\n", str);

    for (i = 0; i < 0x800001; ++i)
    {
        ret = reverser (str, strlen (str));
    }

    printf ("reversely string : %s \r\n", str);

    return 0;
}
void reverse(char s[])
{
	void reverser(char s[],int i,int len);

	reverser(s,0,strlen(s));
}