Sorting letters in a string/ comparing strings

Hello Guys! Super Beginner here! I just want to ask about sorting letters in a string. So below is the code that i've done. Can you help me on sighting errors that unable the program to sort letters in the string as well as on the predefined functions that i've used. I think, i've used these said functions improperly. Thanks in advance ^_^ and Godbless!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define s scanf
#define p printf
int check();
int check2();
 char first[10];
      char second[10];
      char retry,temp;
      int st1, st2,a,b;
int main()
{
      
      p("\n\n\n\t\t\t   A N A G R A M   C H E C K E R \n");
      p("\t_________________________________________________________________\n");
      puts("\nEnter First Word: ");
      gets(first);
      puts("\nEnter Second Word: ");
      gets(second);
      check();
      
      first[10]=check();
      second[10]=check2();
      
      p("\n\n  _______________________________________________________________\n    RESULT:");
     {
       if (stricmp(first,second)==0)
          {
                                    p (" %s and %s are Anagram Words!", first, second);
          }
       else
          {
                                    p (" %s and %s are Not Anagram Words!", first, second);
          }
      }
      p ("\n\n    **Retry the Program? [Y/N]: ");
      s ("%s", &retry);
      
      retry= toupper(retry);
          {
           if (retry=='Y')
               {
                 main();
               }
           else 
               {
                 system ("pause");
               }
           }
getch ();
return 0;
}


int check()

{
    
        strlen(first)==st1;
        
    
      for (a = 0; a < st1-1; a++)
    {
        if (first[a] > first[a+1])
        {
        
            temp = first[a+1];
            first[a+1] = first[a];
            first[a] = temp;
          
            a = -1;
        }
        else
        {
            continue;
        }
    }
  
return(first[10]);
}

int check2()
{
       strlen(second)==st2;    
       for (a = 0; a < st2-1; a++)
    {
        if (second[a] > first[a+1])
        {
           
            temp = second[a+1];
            second[a+1] = second[a];
            second[a] = temp;
         
            a = -1;
        }
        else
        {
            continue;
        }
    }
return(second[10]);
}
Hi!

Can you email me the code? sparkprogrammer@gmail.com

I'd like to take a better look at it. The sorting loop is wrong, I can tell you that. But I'm hoping to email you back the code with comments, etc...

Joe
Ok Joe. I'll message you my code tight after I revise it. Thanks and Godbless!
Topic archived. No new replies allowed.