Feb 9, 2010 at 8:57am UTC
#include <bios.h>
#include <stdio.h>
#include <conio.h>
#define SETTING (0x00 | 0x02 | 0xC0 | 0x08)
#define COM1 0
void main()
void sort(int a[], int b[], int elements)
{
int i, j, temp, temp_b;
i = 0;
while(i < (elements - 1))
{
j=i+1;
while(j < elements)
{
if(a[i] > a[j])
{
temp = a[i];
temp_b = b[i];
a[i] = a[j];
b[i] = b[j];
a[j] = temp;
b[j] = temp_b;
}
j++;
}
i++;
}
{
int average;
int rx, status;
char student[5][20]={"John", "sam", "clinton", "harry","Tom"};
int Electronic[5] = {85,71,50,89,74};
int Automation[5] = {79,85,65,77,69};
int arrange[5] = {0,1,2,3,4};
int loop;
float avg[5];
bioscom(0, SETTING, COM1);
printf("For Receivinf Only!\n\n Press <ESC> to quit\n");
while(1)
{
bioscom(1,0,COM1);
status=bioscom(3,0,COM1);
if((status & 0x100)!=0)
rx=rx & 0x7f;
if(rx==0x31)
{
printf("Received 1 display Electronics Module \n");
for(loop=0; loop < 5; loop++)
printf(" %d %s \n", Electronic[loop], student[arrange[loop]]);
sort(Electronic, arrange, 5);
printf("After the sort the array was \n");
for(loop = 0; loop < 5; loop++)
printf(" %d %s \n", Electronic[loop], student[arrange[loop]]);
getch();
}
if(rx==0x32)
{
printf("Received 2 display Automation Module\n");
for( loop = 0; loop < 5; loop++)
printf(" %d %s \n", Automation[loop], student[arrange[loop]]);
sort( Automation, arrange, 5);
printf("After the sort the array was \n");
for( loop = 0; loop < 5; loop++)
printf(" %d %s\n", Automation[loop], student[arrange[loop]]);
getch();
}
if(rx==0x33)
{
for(loop = 0; loop < 5; loop++)
average = (Automation[loop] + Electronic[loop])/2;
printf("Before the sort the array was\n");
for(loop = 0; loop < 5; loop++)
printf("%d%s\n", avg[loop], student[arrange[loop]]);
sort(average, arrange, 5);
printf("After the sort the array was \n");
for(loop = 0; loop <5; loop++)
printf("%d%s\n", average, student[arrange[loop]]);
getch();
}
}
{
rx=bioscom(2,0,COM1);
if((rx & 0xE0)!=0)
{
}
}
putch(0x0d);
putch(0x0a);
{
putch(rx);
if(kbit())
{
rx=getch();
}
if(rx==0x1b)
{
bioscom(1,rx,0);
}
}
}
}
;
I got the delaration syntax error, as above. situated at line 9
Last edited on Feb 9, 2010 at 8:58am UTC