{ "question_id": 2046499, "question_title": "输入一组含n个元素的数据,求这组数据连续上升元素个数的最大值,请问下面代码哪里写错了?", "question_content": "输入一组含n个元素的数据,求这组数据连续上升元素个数的最大值,请问下面代码哪里写错了?", "difficulty": "简单", "answer_id": 11465862, "answer_content": "
\n#include <stdio.h>\nint main(){\n int n;\n while (scanf("%d",&n)!=EOF) {\n int t=0,sum=0,a[1000];\n for(int i=0; i<n; i++) {\n scanf("%d",&a[i]);\n }\n for(int i=1; i<n; i++) {\n if(a[i-1]<a[i]) {\n t++;\n if(sum<t)\n sum=t; //将最大的t赋值给sum \n } else\n t=0;\n }\n if(sum==0) {\n sum=0;\n } else sum=sum+1;\n printf("%d\\n",sum);\n }\n return 0;\n}
\n\n", "tag_name": "c++", "cpp": "#include