[問題] 製作postfix出現異常輸出
開發平台(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