Sunday, 15 April 2012

c++ - Countless errors in simple program -



c++ - Countless errors in simple program -

the errors go away when remove couts/cins:

std::basic_istream<_chart, traits>::_istream_type& std::basic_istream<_chart, _traits>::operator>>(long double&) [with _chart = char, _traits = std::char_traits, std::basic_istream<_chart, traits>::_istream_type = std::basic_istream]

and here's code:

#include <iostream> #include <string> using namespace std; int main() { int x; int y; int z; cout << "enter number of girrafes" << endl; cin >> x >> endl; cout << "enter number of elephants" << endl; cin >> y >> endl; cout << "enter number of tigers" << endl; cin >> z >> endl; }

cin >> x >> endl; illegal, it's saying "read endl".

just utilize cin >> x;.

c++ cout cin

No comments:

Post a Comment