[問題] 製作postfix出現異常輸出

看板C_and_CPP作者 (天生我材)時間12年前 (2012/04/15 18:00), 編輯推噓0(004)
留言4則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) DEV C++ 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): input 6 + 2 * 3 output 6 2 3 * + ___ 正常output因該是 6 2 3 * + 我有寫一個暫存函式存放operator 餵入的資料(Input): 如上!! 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) int main(){ int k,l; char in[50] = { 0 },post[50] = { 0 }; scanf("%d", &k); for(l=0;l<=k;l++){ fgets(in, sizeof(in), stdin); in[strlen(in) - 1] = '\0'; infix2postfix(&in[0],&post[0],1); printf("%s",&post[0]); } system ("pause"); return 0; } 這是我主main的寫法不知道會有影響到輸入及輸出資料段嘛?! 麻煩給我點見解><" infix ---> postfix 真是特別難搞呀!! 補充說明(Supplement): -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.242.16

04/15 18:05, , 1F
你的底線的意思是空白?
04/15 18:05, 1F

04/15 18:20, , 2F
對呀 是空白
04/15 18:20, 2F

04/15 22:12, , 3F
所以你的意思是空白不要印?如果這樣就判斷剩下的是不是都
04/15 22:12, 3F

04/15 22:12, , 4F
是空白?
04/15 22:12, 4F
文章代碼(AID): #1FYfmfl_ (C_and_CPP)