cpp2.cpp

来自「2007中兴面试题 答案.有完整的代码和调试。」· C++ 代码 · 共 42 行

CPP
42
字号
# include <fstream.h>
int main()
{



	ofstream  fout("test2");


		if  (!fout)
		{
			cout <<"can  not  open  the  file.\n";
			return  1;
		}
		char  obi[80];
		int  k;

		cout<<"input  the  letters  and  a  number !\n";

          cin>>obi>>k;
		  fout  <<  obi<<"!"<<endl<<k<<' '<<hex<<k<<endl;
		
		fout.close();

		ifstream  fin("test2");
		  if(!fin)
		  {
			  "cout  not  open  the  file.\n";
				  return  1;
		  }
		  

		  char  str[80];
		  int  i,j;
		  fin>>str>>i>>j;
		  cout  << str  <<" "<<i <<"  "<<j<<endl;
		  fin.close();


		  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?