#include <iostream>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cfloat>
#include <cstring>
#include <string>
using namespace std;
struct news
{
char a[10];
int n;
float r;
};
int main()
{
news k;
cin >> k;
cout << k.a << endl;
cout << k.n << endl;
cout << k.r << endl;
return 0;
}
它给了我一个全屏的错误。有人知道如何解决这个问题吗?谢谢!
test.cc:在函数'int main()'中:test.cc:20:错误:'std :: cin >> k'中的'operator>>'不匹配/usr/include/c++/4.2.1/ istream:131: 注意:候选者是:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>& (*)(std: :basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:135: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std ::char_traits] /usr/include/c++/4.2.1/istream:142: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/ istream:178: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char, _Traits = std::char_traits] /usr/include /c++/4.2.1/istream:182: 注意: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char, _Traits = std ::char_traits] /usr/include/c++/4.2.1/istream:185: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [与 _CharT = char,_Traits = std::char_traits] /usr/include/c++/4.2.1/istream:189: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:192: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>> (unsigned int&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:196: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT , _Traits>::operator>>(long int&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:200: 注意:std::basic_istream<_CharT, _Traits >& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:205: 注意: std::basic_istream<_CharT, _Traits>& std: :basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:209: 注意: std:: basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1 /istream:214: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char, _Traits = std::char_traits] /usr/包括/c++/4.2.1/istream:218:注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1 /istream:222: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char, _Traits = std::char_traits] /usr /include/c++/4.2.1/istream:226: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char, _Traits = std::char_traits] /usr/include/c++/4.2.1/istream:250: 注意:std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std ::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits]