#5093: 可否幫幫我?(WA)


wuchonson (一WS神教o無用(進建中記得加資訊))

學校 : 臺北市立忠孝國民中學
編號 : 14037
來源 : [210.71.78.242]
最後登入時間 :
2013-06-17 08:56:19
a009. 解碼器 -- ACM 458 | From: [111.184.30.52] | 發表日期 : 2011-05-01 22:45

程式碼看似沒有問題

但每一次測試答案最後面會多出一個星號

 而放上去的結果卻是......

與正確輸出不相符(line:1)
您的答案為: *CDC is the trademark of the Control Data Corporation.*IBM ...略
正確答案為: *CDC is the trademark of the Control Data Corporation.

可否幫幫忙?

程式碼:

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    char c;
    do{
       cin.get(c);
       c-=7;
       cout << c; 
    }while(!cin.fail());
   
 

        return EXIT_SUCCESS;
}

謝謝

 

 
#5113: Re:可否幫幫我?(WA)


ray57diary79 (無)

學校 : 不指定學校
編號 : 18790
來源 : [114.32.244.119]
最後登入時間 :
2011-07-09 06:24:19
a009. 解碼器 -- ACM 458 | From: [210.60.55.157] | 發表日期 : 2011-05-14 10:54

程式碼看似沒有問題

但每一次測試答案最後面會多出一個星號

 而放上去的結果卻是......

與正確輸出不相符(line:1)
您的答案為: *CDC is the trademark of the Control Data Corporation.*IBM ...略
正確答案為: *CDC is the trademark of the Control Data Corporation

cin.get(c)  沒有處理換行字元'\n',所以後面有亂碼


 
ZeroJudge Forum