Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
139894 胡海峰老师 09闰年第n个月有多少天 C++ Compile Error 0 MS 0 KB 1064 2025-12-11 15:13:26

Tests(0/0):


Code:

#include <iostream> //designed by hu 2025-10 using namespace std; int main(){ //Month( 4,6,9,11)----> 30 Days //Month( 2 )----> 29 Days //Month( 1,3,5,7,8,10,12)----> 30 Days int n; // 1- 12(valid合法) ,不在这个区间(invalid 非法) cin >> n; //从键盘输入一个月份 if( n==2) { cout << 29; } else if( n==4 || n==6 || n==9 || n==11) {#include <iostream> //designed by hu 2025-10 using namespace std; int main(){ //Month( 4,6,9,11)----> 30 Days //Month( 2 )----> 29 Days //Month( 1,3,5,7,8,10,12)----> 30 Days int n; // 1- 12(valid合法) ,不在这个区间(invalid 非法) cin >> n; //从键盘输入一个月份 if( n==2) { cout << 29; } else if( n==4 || n==6 || n==9 || n==11) { cout << 30; } else if( n<1 || n>12 ) { cout << "Invalid."; } else{ cout << 31; } return 0; } cout << 30; } else if( n<1 || n>12 ) { cout << "Invalid."; } else{ cout << 31; } return 0; }


Run Info:

Main.cc:16:4: error: stray '#' in program
   {#include 
    ^
Main.cc: In function 'int main()':
Main.cc:16:5: error: 'include' was not declared in this scope
   {#include 
     ^
Main.cc:16:22: error: expected primary-expression before '>' token
   {#include 
                      ^
Main.cc:18:1: error: expected primary-expression before 'using'
 using namespace std;
 ^
Main.cc:20:11: error: a function-definition is not allowed here before '{' token
 int main(){
           ^
Main.cc:58:1: error: expected '}' at end of input
 }
 ^
Main.cc:58:1: error: expected '}' at end of input