标签:pre class sample nbsp std 整数 using 表示 name
1 #include <stdio.h> 2 #include<iostream> 3 #include <vector> 4 #include <algorithm> 5 using namespace std; 6 int abs(int a){ 7 return a>0?a:-a; 8 } 9 int bigger(int a, int b){ 10 return abs(a)>abs(b); 11 } 12 int main(){ 13 int count = 0; 14 scanf("%d", &count); 15 int buff[100]; 16 while(count!=0){ 17 for(int i=0;i<count;++i){ 18 scanf("%d", buff+i); 19 } 20 sort(buff, buff+count, bigger); 21 for(int i=0;i<count;++i){ 22 printf("%d", buff[i]); 23 if(i!=count-1) 24 printf(" "); 25 } 26 if(count!=0)printf("\n"); 27 scanf("%d", &count); 28 } 29 }
标签:pre class sample nbsp std 整数 using 表示 name
原文地址:https://www.cnblogs.com/hacnix/p/14472901.html