Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language program error correction
C language program error correction
Don't just read the beginning. Conio.h at the beginning is not the point. Keep reading. Don't be so careless. Later revision is the key. You won't miss the goal, will you? !

Revise as follows:

// -

# include & ltstdio.h & gt

# include & ltconio.h & gt

#define ARR_SIZE 40

int main(void)

{

float score[ARR_SIZE],temp 1;

int n,I,j;

long num[ARR_SIZE],temp2

Printf ("Please enter total:");

scanf("%d ",& ampn);

Printf ("Please enter numbers and scores: \

");

for(I = 0; I & ltn;; i++)

/* * * * * * * * * * * * * * * Note here */

{

Scanf("%ld%f ",& numbers [i], & AMPScore [I]);

}

for(I = 0; I<n-1; i++)

{

for(j = I+ 1; j & ltn; j++)

{

if(score[j]& gt; Score [I])/* * * * * * * * * * * * * * * * * * * * Note here * * *

{

temp 1 = score[j];

score[j]= score[I];

score[I]= temp 1;

temp 2 = num[j];

Number [j]= number [I];

num[I]= temp 2;

}

}

}

Printf ("Sorting result: \

");

for(I = 0; I & ltn;; i++)

{

printf("%ld\\t%4.0f\

“,num[i],score[I]);

}

getch();

Returns 0;

}

// -