#10321: 這是甚麼情況


GaryMara (cronus6w6)


我的程式碼是:

#include <iostream>

using namespace std;

 

int main(){ 

int a;

while(cin >>a){

cout << "'C' can use printf(&quot;%d&quot;,n); to show integer like ";

cout << a << endl; 

}

 

}

我也測試可以

但是它卻出現:

第 1 測資點(100%): WA (line:1) 
答案不正確 

您的答案為: 'C' can use printf("%d",n); to show integer like ...略
正確答案為: 'C' can use printf("%d",n); to show integer like 1252
#10322: Re:這是甚麼情況


explorer (explorer)


 

cout << "'C' can use printf("%d",n); to show integer like ";


我記得單引號、雙引號前面應該是都要加反斜線,因為為他是escape character
所以要這樣cout << "\'C\' can use printf(\"%d\",n); to show integer like ";