//P898
#include <fstream>
using namespace std;
int main()
{
ofstream outFile("copy.txt");
if(!outFile)
{
cerr<<"cannot open for output\n";
return -1;
}
char ch;
while (cin.get(ch))
outFile.put(ch);
}
e:\源代码\c++ primer\chapter 20\20_6.cpp(10) : error C2065: 'cerr' : undeclared identifier
e:\源代码\c++ primer\chapter 20\20_6.cpp(10) : error C2297: '<<' : illegal, right operand has type 'char [24]'
e:\源代码\c++ primer\chapter 20\20_6.cpp(14) : error C2065: 'cin' : undeclared identifier
e:\源代码\c++ primer\chapter 20\20_6.cpp(14) : error C2228: left of '.get' must have class/struct/union type
e:\源代码\c++ primer\chapter 20\20_6.cpp(14) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.20_6.exe - 5 error(s), 0 warning(s)
#include <fstream>
using namespace std;
int main()
{
ofstream outFile("copy.txt");
if(!outFile)
{
cerr<<"cannot open for output\n";
return -1;
}
char ch;
while (cin.get(ch))
outFile.put(ch);
}
e:\源代码\c++ primer\chapter 20\20_6.cpp(10) : error C2065: 'cerr' : undeclared identifier
e:\源代码\c++ primer\chapter 20\20_6.cpp(10) : error C2297: '<<' : illegal, right operand has type 'char [24]'
e:\源代码\c++ primer\chapter 20\20_6.cpp(14) : error C2065: 'cin' : undeclared identifier
e:\源代码\c++ primer\chapter 20\20_6.cpp(14) : error C2228: left of '.get' must have class/struct/union type
e:\源代码\c++ primer\chapter 20\20_6.cpp(14) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.20_6.exe - 5 error(s), 0 warning(s)
#include <iostream.h>
#include <iostream> -> this is for STL.but not
#include <iostream.h> -> this is for common c++ io stream