[問題] 強制位數

看板C_and_CPP作者 (毛毛)時間13年前 (2012/06/07 22:21), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) DEVC++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 如何顯示六位數 餵入的資料(Input): 例如:0 會變成000000 3會變成000003 預期的正確結果(Expected Output): 如上 錯誤結果(Wrong Output): 不知道如何使用 都只會顯示原來的數字 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): 有查過 但是好像都只有強制小數點後幾位的 有沒有可以往前補的 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.46.148.167

06/07 22:23, , 1F
printf("%06d\n", 3);
06/07 22:23, 1F
文章代碼(AID): #1FqBa520 (C_and_CPP)