mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
code cleanup & fixed syntax error
This commit is contained in:
parent
a3989bbadc
commit
cee2468506
@ -4,24 +4,20 @@
|
|||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, arraySort[MAX] = {0}, isSort = FALSE, changePlace;
|
int i, arraySort[MAX] = {0}, isSort = FALSE, changePlace;
|
||||||
|
|
||||||
|
|
||||||
/* For example
|
/* For example
|
||||||
Insertion random values in array to test
|
Insertion random values in array to test
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < MAX; i++)
|
for (i = 0; i < MAX; i++)
|
||||||
{
|
{
|
||||||
arraySort[i] = rand() % 101;
|
arraySort[i] = rand() % 101;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Algorithm of bubble methods */
|
/* Algorithm of bubble methods */
|
||||||
|
|
||||||
while (isSort)
|
while (isSort)
|
||||||
@ -32,12 +28,11 @@ int main()
|
|||||||
{
|
{
|
||||||
if (arraySort[i] > arraySort[i + 1])
|
if (arraySort[i] > arraySort[i + 1])
|
||||||
{
|
{
|
||||||
changePlace = arratSort[i];
|
changePlace = arraySort[i];
|
||||||
arraySort[i] = arraySort[i + 1];
|
arraySort[i] = arraySort[i + 1];
|
||||||
arraySort[i + 1] = changePlace;
|
arraySort[i + 1] = changePlace;
|
||||||
isSort = TRUE;
|
isSort = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,9 +43,5 @@ int main()
|
|||||||
printf("%d\n", arraySort[i]);
|
printf("%d\n", arraySort[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user