读书人

%s和%-s有什么区别啊该怎么解决

发布时间: 2012-03-24 14:00:46 作者: rapoo

%s和%-s有什么区别啊。
如题

[解决办法]
-是指左对齐,在指定的宽度内,默认右对齐(Left-justify within the given field width; Right justification is the default)
%s和%-s没有指定宽度,二者没区别



[解决办法]
-, which specifies left adjustment of the converted argument in its field.
[解决办法]

探讨
-是指左对齐,在指定的宽度内,默认右对齐(Left-justify within the given field width; Right justification is the default)
%s和%-s没有指定宽度,二者没区别

[解决办法]
对齐方式、、
[解决办法]
C/C++ code
#include<stdio.h>#include<stdlib.h>int main(){    int i,j;    i=-78;    j=65535;        printf("%d%d\n",i,j);    printf("%4d%4d\n",i,j);    printf("%-4d%-4d\n",i,j);    printf("%+4d%+4d\n",i,j);     printf("%#x%#X\n",i,j);    printf("%04d%04d\n",i,j);    printf("% d% d\n",i,j);    system("pause");    return 0;} 

读书人网 >C语言

热点推荐