| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 159505 | 解禾溪 | 09优惠活动 | C++ | Compile Error | 0 MS | 0 KB | 578 | 2026-09-04 19:25:44 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a,b,P,G,S; cin>>a>>b; if(b=P){ cout<<a<<a*0.7; } else if(b=G){ cout<<a<<a*0.8; } int a,b,P,G,S; cin<<a<<b; if(b==P){ cout<<a<<a*0.7; } else if(b==G){ cout<<a<<a*0.8; } else if(b==S){ cout<<a<<a*0.9; } else{ cout<<a<<a*0.95; } return 0; }
Main.cc: In function 'int main()':
Main.cc:10:11: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if(b=P){
^
Main.cc:13:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
else if(b=G){
^
Main.cc:16:6: error: redeclaration of 'int a'
int a,b,P,G,S;
^
Main.cc:8:9: note: 'int a' previously declared here
int a,b,P,G,S;
^
Main.cc:16:8: error: redeclaration of 'int b'
int a,b,P,G,S;
^
Main.cc:8:11: note: 'int b' previously declared here
int a,b,P,G,S;
^
Main.cc:16:10: error: redeclaration of 'int P'
int a,b,P,G,S;
^
Main.cc:8:13: note: 'int P' previously declared here
int a,b,P,G,S;
^
Main.cc:16:12: error: redeclaration of 'int G'
int a,b,P,G,S;
^
Main.cc:8:15: note: 'int G' previously declared here
int a,b,P,G,S;
^
Main.cc:16:14: error: redeclaration of 'int S'
int a,b,P,G,S;
^
Main.cc:8:17: note: 'int S' previously declared here
int a,b,P,G,S;
^
Main.cc:17:5: error: no match for 'operator<<' (operand types are 'std::istream {aka std::basic_istream}' and 'int')
cin<
Main.cc:17:5: note: no known conversion for argument 1 from 'std::istream {aka std::basic_istream}' to 'int'
In file included from /usr/include/c++/5/string:52:0,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from Main.cc:1:
/usr/include/c++/5/bits/basic_string.h:5172:5: note: candidate: template 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:17:7: note: 'std::istream {aka std::basic_istream}' is not derived from 'std::basic_ostream<_CharT, _Traits>'
cin<