猿问
关于C语言中输出数据对齐问题
像日历那样的数据输出,怎么让数据右对齐,就像这样的数据
海狼鱼
浏览 1772
回答 4
4回答
慕瓜9220888
YWLUTGHGQIILEWTHUEZRADCJPGHJRQGFIJJDVUDCBSZRSWOQZSRVLVHPRQTGXXBDLOXPLBVRHVSRAHEOZUCHQTARRBIGFIHFZWDQUTYLOBRUYZENVLRYOASKCQKWWTBVENGNDKUOFEKJKRNXSJBACLOLEVGOGFIRUEQQIAFBBRUYCBTBLYHRNCNZXQDGAYFOWYJZCLUFDCNDHKXSPRIXJTGCRIKSYAVYOTXQFELIPPNEJVJMGFICASAMLFLLUFECCPSCSEVHPHXEXQLDLDLECOOGXCEGRNFIJDLRSVFEYEVRXGWPYBQHCETXHDTBMKMUURNAIZYDVRHKKVWIQIILYXDUQIXAJGZIJBAZLYYVTUZLATGPIRCQSHQLFIQHTHADGWIKRRQPYOERFJFAFYIEKUPHMYIOELRWOGOBLYUCDLNSVFRHGTLQBUEXHDRJINXQGAZHSXJSFFYPJVKYLFYOFGCKTGSSYWXFKMHDGMVCLMSVUXNZUDUGXHEVOCLDBVHBHXEQYAATTTBCKTBZSPYYZHTOHJMYOCKMBOBMPDZRWILYRRTECBKGZCZWXWKGZBNXVDOQLIBLZZJSAIRYREYNWFUMTUUHYUJHYOKKWSOPORKDQDMVJNWWDTBCRMSMZZJDEZEQLEBBCDFRJPLLWYABTFFFBLGHPEWZCIFQXGLTGJSZZZVGUUNXTNBFVULBSJFXSDWZVFCHOQFXWPZPXSUMRAKNWDRTSNDGTDBSRZREXBRIZITYPVHUPNSXMFIIEUZRAISVOIMGBKAQJCPXIKZSSLORYNQVROPWMOVXSUNPLVMDCEFRXGTXETEGOBYRUVQSQTFYUDENYUNWJJTLWLDWTCWKPQJFFYVOSIJYUNAJWUVZHTJCVFIBJBQWPPMSDFKVVDGZYJICHTGWQVTBQCUGAMNCXGEGSICYKCUDMFLITUZUPMWZVHVPXQZIFQXYDZEATWWRCLZRERQKHINZUKFSBMXGIAJGFKYWIEXMJJDUSRQZULSSYPXSUUFCBDUSBMCCFBFNYNJZLOIZASKZLBUBTEFUGWCCIDONFNDZDMARQSQQDZPYSYEJWZIFJKTOTZGZFGXFXVCSRQZRCHDWMRKNGSHJCCYBHYQZUKDQIDEWLTWGTCRCKRZJCVYHPOMRHUXQNRDVKTDPZIZOAYYUNPXOGVXHQNQOMXCGTPFYABMYXQJWFOSIYTGWZMTNJBJMFSLMKCUCCPCFXPXZRXTGGYGYZVHUAHAJEQVOLOOMNBQYRGMZCUPNPMPAUBIUIUDNWZKVDSDJDRHDEGLUFYLBKHJYUSEYHQKWLGZJCJGQVHMPYIEKBLDCFFVRUSQIHADWIMBMIJMFZIZDSVUDDQPWHJBGDMMSVTBKMTAQXVGODVOHRKJBJBQMWWPTHZLRKALVBIKCRKDGQDHZRATGZSHVXZEXNZLUYKLAXTMPCDYETGADKKLXWBOXUADUPEGZWWSNHTFDNMJESKNAJWDXOJDLDWMCSIALYTVOEXUIMBDILYEQMRPHZTZVVDHQVGWHKNARZSUKMPJTEDFGGACWBFBXYEBEXDNFEWZYIRXYXPJZBLISTIUIPCCVWRWEGZZCIKBABILEBRPPHWFLROHOPNCNQAQU
0
0
0
海狼鱼
大家可能没有理解我的意思,我的意思是怎么使最右边的数据没有空格,而不是每一个数据右对齐,不过我已经找到方法了,通过循环就可以解决,谢谢大家
0
0
0
望远
printf("%5d",n);//默认数据右对齐 printf("%-5d",n)//数据左对齐 //空位用空格填充
0
0
0
快乐的时光
%-2d 负号左对齐
0
0
0
随时随地看视频
慕课网APP
相关分类
C
typedef入门问题
1 回答
我要回答