首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

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

2012-03-24 
%s和%-s有什么区别啊。如题[解决办法]-是指左对齐,在指定的宽度内,默认右对齐(Left-justify within the giv

%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;} 

热点排行