第4章练习题--8--浮点数格式--2799

来源:互联网 发布:丰富的网络资讯吸引 编辑:程序博客网 时间:2024/06/08 03:31

这道题太坑爹了,排列!=排序!!!


#include <iostream>#include <stdio.h>#include <string>#include <string.h>#include <vector>#include <list>#include <math.h>#include <algorithm>using namespace std;int main(){    int maxnum , n , i , j , k ;char str[10001][51] ;scanf( "%d" , &n );memset( str , 0 , sizeof(char)*10001*51 );maxnum = 0;for( i = 0 ; i < n ; i++ ){scanf("%s",str[i]);for( j = 0 ; str[i][j]!='\0' ; j++ )if( str[i][j] == '.' ) break ;if( j > maxnum ) maxnum = j ;}for( i = 0 ; i < n ; i++ ){for( j = 0 ; str[i][j]!='\0' ; j++ )if( str[i][j] == '.' ) break ;for( k = 0 ; k < ( maxnum - j ) ; k++ )printf(" ");printf( "%s\n" , str[i] );}        return 1;    }


原创粉丝点击