A
arnuld
I get an error, can't find what is the problem:
/* C++ Primer - 4/e
*
* Chapter 8, exercise 8.3
* STATEMENT
* write a function that takes and returns an istream&. the function
should read the stream untill it hits the EOF and should print what it
read to the standard output. reset the stream so that it is valid and
return the stream.
*
*/
#include <iostream>
#include <istream>
istream& stream_game( std::istream& i_strm) /* this is line #14 */
{
while( std::istream >> i_strm )
{
std::cout << i_strm;
}
std::istream.clear();
return i_strm;
}
int main()
{
std::istream& i_strm;
stream_game( i_strm );
return 0;
}
/* OUTPUT
~/programming/cpp $ g++ -ansi -pedantic -Wall -Wextra ex_08.03.cpp
ex_08.03.cpp:14: error: expected constructor, destructor, or type
conversion before '&' token ~/programming/cpp $
*/
/* C++ Primer - 4/e
*
* Chapter 8, exercise 8.3
* STATEMENT
* write a function that takes and returns an istream&. the function
should read the stream untill it hits the EOF and should print what it
read to the standard output. reset the stream so that it is valid and
return the stream.
*
*/
#include <iostream>
#include <istream>
istream& stream_game( std::istream& i_strm) /* this is line #14 */
{
while( std::istream >> i_strm )
{
std::cout << i_strm;
}
std::istream.clear();
return i_strm;
}
int main()
{
std::istream& i_strm;
stream_game( i_strm );
return 0;
}
/* OUTPUT
~/programming/cpp $ g++ -ansi -pedantic -Wall -Wextra ex_08.03.cpp
ex_08.03.cpp:14: error: expected constructor, destructor, or type
conversion before '&' token ~/programming/cpp $
*/