#5281: 跑程式持續CE...


woeichern (小暐)

學校 : 國立清華大學
編號 : 19327
來源 : [136.23.34.64]
最後登入時間 :
2024-04-14 12:28:17
a004. 文文的求婚 | From: [123.193.68.232] | 發表日期 : 2011-07-02 19:42

 想請問各位高手

我現在在解文文出國那題

也就是要算平年或閏年那題

 程式是寫好了

但怎麼跑都是CE

而我也看不懂編譯器訊息寫什麼

 有人可以看出我的程式碼那裡有問題嗎?

感激不盡!!!

===========================

#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include<sstream>
using namespace std;  
int main()
{
    int n;
    string s;
     while(cin >> s)
     {

         n =  atoi(s.c_str());
         if(n % 4 != 0)
         {
              cout << "平年" << endl;
     }
         else
     {
             if(n % 25 == 0 && n % 16 == 0)
             {

                  cout << "閏年"<< endl;

             }
             else
             {
                  cout << "平年"<< endl;
             }
         }
          
     }
    return 0;
}  

 

======================

編譯錯誤, 請檢查語法是否符合系統所支援的編譯器的要求。
錯誤訊息:
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program

 
#5282: Re:跑程式持續CE...


abcd6891 (曄哥)

學校 : 國立花蓮高級中學
編號 : 3565
來源 : [61.231.222.61]
最後登入時間 :
2024-09-16 11:43:21
a004. 文文的求婚 | From: [114.44.212.41] | 發表日期 : 2011-07-02 20:03

 想請問各位高手

我現在在解文文出國那題

也就是要算平年或閏年那題

 程式是寫好了

但怎麼跑都是CE

而我也看不懂編譯器訊息寫什麼

 有人可以看出我的程式碼那裡有問題嗎?

感激不盡!!!

===========================

#include
#include
#include
#include
#include
using namespace std;  
int main()
{
    int n;
    string s;
     while(cin >> s)
     {

         n =  atoi(s.c_str());
         if(n % 4 != 0)
         {
              cout << "平年" << endl;
     }
         else
     {
             if(n % 25 == 0 && n % 16 == 0)
             {

                  cout << "閏年"<< endl;

             }
             else
             {
                  cout << "平年"<< endl;
             }
         }
          
     }
    return 0;
}  

 

======================

編譯錯誤, 請檢查語法是否符合系統所支援的編譯器的要求。
錯誤訊息:
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program

 

裡面有很多不是空白,但是看起來是空白的字元 

 
#5283: Re:跑程式持續CE...


woeichern (小暐)

學校 : 國立清華大學
編號 : 19327
來源 : [136.23.34.64]
最後登入時間 :
2024-04-14 12:28:17
a004. 文文的求婚 | From: [123.193.68.232] | 發表日期 : 2011-07-02 20:16

 想請問各位高手

我現在在解文文出國那題

也就是要算平年或閏年那題

 程式是寫好了

但怎麼跑都是CE

而我也看不懂編譯器訊息寫什麼

 有人可以看出我的程式碼那裡有問題嗎?

感激不盡!!!

===========================

#include
#include
#include
#include
#include
using namespace std;  
int main()
{
    int n;
    string s;
     while(cin >> s)
     {

         n =  atoi(s.c_str());
         if(n % 4 != 0)
         {
              cout << "平年" << endl;
     }
         else
     {
             if(n % 25 == 0 && n % 16 == 0)
             {

                  cout << "閏年"<< endl;

             }
             else
             {
                  cout << "平年"<< endl;
             }
         }
          
     }
    return 0;
}  

 

======================

編譯錯誤, 請檢查語法是否符合系統所支援的編譯器的要求。
錯誤訊息:
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\343’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:18: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\343’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program
/tmp/code_832737.cpp:20: error: stray ‘\200’ in program

 

裡面有很多不是空白,但是看起來是空白的字元 

我了解了!

感謝指教喔!!!

 
ZeroJudge Forum