Показать сообщение отдельно

  #1648  
Старый 31.08.2009, 12:16
\\ChaOs//
Познающий
Регистрация: 26.02.2009
Сообщений: 65
Провел на форуме:
583734

Репутация: 34
По умолчанию

Цитата:
Сообщение от Тилль  
...
Код:
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
const char name[]="file.txt";
const int size=2;

int _tmain(int argc, _TCHAR* argv[])
{
string buf="";
char ch=0;
int i=0;
ifstream file(name);
if(file)
{
	while(file.get(ch))
	{
		if(!(ch>47 && ch<58))
		{
			if(i==size) cout<<buf<<" ";
			buf=""; i=0;
		}
		else
		{
		buf=buf+ch;
		i++;
		}
	}
if(i==size) cout<<buf<<" ";
file.close();
system("pause");
return 0;
}
}

Последний раз редактировалось \\ChaOs//; 02.09.2009 в 15:49..
 
Ответить с цитированием