< iostream>
< fstream>
< stdlib.h>
main(int argc,char * argv[])
{
number[9]={11,22,33,44,55,66,77,88,99};
(argc!=3)
{
std::cout << "argc=" << argc << "\n";
std::cout << "Error in arguments";
(1);
}
std::ofstream fout1,fout2;
fout1.open(argv[1]);
(fout1.fail())
{
std::cout <<"could not open the file";
(1);
}
fout2.open(argv[2]);
(fout2.fail())
{
std::cout << "could not open the file" << argv[2] << "\n";
(1);
}
(int i=0;i < 9;i++)
{
(number[i]%2==0)
fout2 << number[i] << " ";
else
fout1 << number[i] << " ";
}
fout1.close();
fout2.close();
std::ifstream fin;
ch;
i;
(i=1;i < argc;i++)
{
fin.open(argv[i]);
std::cout << "contest of" << argv[i] << "\n";
{
fin.get(ch);
std::cout << ch;
}
(fin);
std::cout << "\n\n";
fin.close();
}
0;
}
|