Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
10
Добавлен:
25.05.2014
Размер:
2.56 Кб
Скачать
/*‹ Ў®а в®а­ п а Ў®в  10
€б Ґў ‚Ёв «Ё© ‚ЁЄв®а®ўЁз
ѓагЇЇ  ‡‚‘11 ў аЁ ­в ь15*/
//ђ Ў®в  б д ©« ¬Ё
#include <conio.h>  //Џ®¤Є«оз Ґ¬ ¬®¤г«м нЄа ­ 
#include <fstream.h> //Њ®¤г«м ўў®¤  ўўлў®¤  Ї®в®Є®ў
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char txt[16384];
char p[255];
char sit[255];
int i,l,q=0,k;
int is,ss;//‘зҐвзЁЄ б«®ў 
int ltxt;//„«Ё­  ⥪бв 
int lpred;//„«Ё­  ЇаҐ¤«®¦Ґ­Ёп
int spred,epred;//„«Ё­  Ё Є®­Ґж ЇаҐ¤«®¦Ґ­Ёп
fstream f;
void sosl(){// funcstart
 //Ї®ЁбЄ ®ЇаҐ¤Ґ«Ґ­­®Ј® б«®ў 
 l=0;
 for (i=epred;i<ltxt;i++){//ist
 if ((l==0) && (txt[i]==32))  i++ ;
  if ((txt[i]=='.') || (txt[i]==',') || (txt[i]=='!') || (txt[i]==';')
    || (txt[i]==':') || (txt[i]=='?') || (txt[i]=='"') || (txt[i]=='\n'))
					i++;
      if (txt[i]!=32) {sit[l]=txt[i];l++;}
       if ((txt[i]==32) && (l>0)) { // s_
			sit[l]='\x0';
			 if (strlen(p)==strlen(sit)) {//ssr
		     for (k=0;k<strlen(p)+1;k++) {//k
			if (p[k]==sit[k]) q=1;
			  else {q=0;k=strlen(p);l=0;}
       }    //k
	if (q==1) {i=ltxt; }
						}//essr
	else l=0;
					}// es_

				}//enist
} //funcEnd
void schslov(){
      //‘зЁвлў Ґ¬ б«®ў®
      ss=0;
      for (is=spred;is<lpred+1;is++){
       if ((ss==0)&&(txt[is]==32)) is++;
       if (txt[is]==',') is++;
	if (txt[is]!=32) {if (is!=lpred) {p[ss]=txt[is];ss++;}
			    else {p[ss]='\x0';spred=lpred;}
			}
	 if ((txt[is]==32) && (ss>0)) {
	  if (ss>1)  {
	       p[ss]='\x0';//'\x0'- Љ®­Ґж бва®ЄЁ ў ЇҐаҐ¬Ґ­­®©
		    spred=is;is=lpred; }
		else ss=0;
		}
				}
}
void strt(){
		l=0;
	   while (!f.eof()){
	       f.getline(p,255);
	       for (i=0;i<strlen(p);i++) {txt[l]=p[i];l++;}
			  txt[l]=' ';l++;
			      }
    ltxt=strlen(txt);
//Џ®ЁбЄ ЇаҐ¤«®¦Ґ­Ёп Ё ҐЈ® ¤«Ё­л
lpred=0;
spred=0;
epred=0;
 for (i=0;i<ltxt;i++)   //‘зЁвлў Ґ¬ ўҐбм ⥪бв Ї®Є  ­Ґ Ї®пўЁвбп в®зЄ 
	if (txt[i]==46) { //…б«Ё ¤«Ё­  ЇаҐ¤«®¦Ґ­Ёп б®бв®ў«пҐв > 4 бЁ¬ў®«®ў
		if (i>4) {lpred=i;epred=i+1;
				break;}//  дЁЄбЁа㥬 ¤«Ё­г Ё ўл室 Ё§ жЁЄ« 
			  else {i++;
			     spred=i+1;} //Ё­ зҐ бзЁвлў Ґ¬ б«Ґ¤го饥 ЇаҐ¤«®¦Ґ­ЁҐ
			}
 //Џа®ў®¤Ё¬ а Ў®вг б ⥪б⮬
 cout << "‚бваҐз ойЁҐбп б«®ў  ў ⥪бвҐ:\t" << "ЌҐ ўбваҐвЁ«Ёбм:\n" ;
 while (spred<lpred){
  schslov();
   sosl();
    if (q==1) {cout << p << "\n"; q=0;}
	else cout << "\t\t\t\t\t"<< p << "\n";
			}
}
void main(){
clrscr();
     f.open ("TXTLAB10.txt", ios::in);
     if (!f) cout << "” ©« 'TXTLAB10.TXT' ­Ґ ®вЄалў Ґвбп";
       else {
		 strt();
		  f.close();
		  }
cout << "\nЏа®ўҐаЄ  § Є®­зҐ­ !!!";
getch();
}
Соседние файлы в папке LABORATORN