Not Yet Answered # Animated output

edrianhadinata Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

1

i find this program from http://www.madharasan.com/

```
/*
* Auther: Jayarathina Madharasan. Y
* Website: http://www.madharasan.com/
* Date: Oct, 10, 2008
* This program performs animation of bubble sort.
The bubble sort works by comparing each item in the list with the item next to
it, and swapping them if required. The algorithm repeats this process until it
makes a pass all the way through the list without swapping any items (in other
words, all items are in the correct order). This causes larger values to
"bubble" to the end of the list while smaller values "sink" towards the
beginning of the list.
*/
#include <stdio.h>
#include <conio.h>
void PrintCurrentState(int numbers[], int max, int j)
{
int i, temp, midt;
clrscr();
printf("\nThe elements are:\n");
for(i = 0; i<max; i++)
{
if (i == j-1)
{
textcolor(GREEN);
gotoxy(wherex(), wherey()+1);
temp = cprintf("%c",24);
gotoxy(wherex()-temp, wherey()-1);
}
else if(i == j)
{
textcolor(GREEN);
gotoxy(wherex(), wherey()+1);
if (numbers[j-1] > numbers[j])
temp = cprintf("%c Will swap",24);
else
temp = cprintf("%c Will not swap",24);
gotoxy(wherex()-temp, wherey()-1);
}
cprintf("%d", numbers[i]);
printf(" ");
textcolor(LIGHTGRAY);
}
delay(1000);
}
void bubbleSort(int numbers[], int array_size)
{
int i, j, temp;
_setcursortype(_NOCURSOR);
for (i = (array_size - 1); i >= 0; i--)
for (j = 1; j <= i; j++)
{
PrintCurrentState(numbers, array_size, j);
if (numbers[j-1] > numbers[j])
{
temp = numbers[j-1];
numbers[j-1] = numbers[j];
numbers[j] = temp;
}
}
PrintCurrentState(numbers, array_size, array_size+1);
_setcursortype(_NORMALCURSOR);
printf("\n\nList is sorted!");
}
int main()
{
int i, a[100], max;
clrscr();
printf("Enter total number of elements:");
scanf("%d", &max);
printf("\nEnter the elements :\n\n");
for (i=0; i<max;i++)
{
printf("Enter %d element:", i+1);
scanf("%d", &a[i]);
}
bubbleSort(a, max);
getch();
}
```

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

```
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
```

the function that I created to find the ...