⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 11_92.cpp

📁 C++程序设计技能百练随书配套光盘的源码
💻 CPP
字号:
#include<iostream.h>
#include<fstream.h>
#include<stdio.h>
#include<stdlib.h>
void main()
{
	int r;	char c;
	fstream file;
	char fn[15],buf[100];
	cout<<"Input the file'name:";
	cin>>fn;
	file.open(fn,ios::nocreate|ios::in);  
	//针对文件后缀为(.txt  .h  .cpp .pas等)文件
	if(!file)
	{
		cout<<"The file you wanted open does NOT exist.";
		abort();  //#include<stdlib.h>
	}
	while(!file.eof())
	{
		r=0;
		while(!file.eof() && r<23)
		{
			file.getline(buf,100);
			cout<<buf<<endl;
			r++;
		}
		cout<<"press 'enter' key...";
		c=getchar();  //#include<stdio.h>
	}
	file.close();
}

⌨️ 快捷键说明

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