Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
124970 | 晏莞煜 | 字符串中最大的数字 | C++ | Compile Error | 0 MS | 0 KB | 663 | 2025-07-13 09:16:15 |
#include<iostream> #include<cstring> using namespace std; char a[100001],b[10001]; int main(){ //strcpy( , ) 将字符数组~复值给~ //strcat( , ) 字符数组拼接 //strcmp(a,b) a>b cout<<"1" a==b cout<<"0" a<b cout<<"-1"; /** cin>>a>>b; lena=strlen(a); ienb=strlen(b); if(lena>lenb){ cout<<a; }else{ if(lena<lenb){ cout<<b; }else{ int e=strcmp(a,b); if(e==1){ cout<<a; }else{ if(e==0){ cout<<"="; }else{ cout<<b; } } } }**/ long long a[9]; cin<<a; int y=a[0]; int e=strlen(a); for(int i=1;i<e;i++){ if(y<a[i]){ y=a[i]; } } cout<<y; return 0; }
Main.cc: In function 'int main()': Main.cc:31:5: error: no match for 'operator<<' (operand types are 'std::istream {aka std::basic_istream}' and 'long long int [9]') cin< std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) operator<<(basic_ostream<_CharT, _Traits>& __os, ^ /usr/include/c++/5/bits/basic_string.h:5172:5: note: template argument deduction/substitution failed: Main.cc:31:7: note: 'std::istream {aka std::basic_istream}' is not derived from 'std::basic_ostream<_CharT, _Traits>' cin<