//????
//??: 2005-7-6
//??????
#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include "Menu.h"
#include "key.h"
#include <stdlib.h>
typedef struct line{
 //char data[80];
 char *data; //???????? ??????
 struct line *next;
}LINE;
void CreateTXT(LINE * &head); //?????????????? ????
int Count_Space(LINE * &head); //???格?
int Count_ZM(LINE * &head); // ?????
int Count_All_Word(LINE * &head); //????????
int Find_Word(LINE * &head,char *sch); //?? sch ?????????
int Count_Num(LINE * &head); //???? ?
void Del_String(LINE * &head,char *sch); //????????
void OutPutTxt(LINE * &head); //????? ??
void Tj(LINE * &head); //??
int _f5_main(){
 LINE *head; //??????
 Menu m[10];
 m[1].Name="?????? ";
 
 m[2].Name="?????? ";
 
 m[3].Name="???? ";
 
 m[4].Name="?????";
 m[5].Name="????? ";
 
 m[6].Name="?? ";
 
 int t=1,ID;
 while(t)
 {
  ShowMenu("????----????",m,6);//????
  ID=SelectMenuID();
  switch(ID)
  {
  case 1:CreateTXT(head);break;
  case 2:{
 //  system("cls"); //??,????shell??
   OutPutTxt(head); //????? ??
   
   InitKey();
    break;
    }
 
  case 3:{
  // system("cls"); //??,????shell??
   Tj(head);
   InitKey(); //????
   break;
    }
  case 4:{
  //  system("cls"); //??,????shell??
    cout<<"/n??????? ???/n";
    char sch[20];
    cin>>sch;
    cout<<"/n"<<sch<<"??????:"<<Find_Word(head,sch);
    InitKey();
    break;
    }
  case 5:{
   cout<<"/n?????????????"<<endl;
   char tmp_sch[20];
   cin>>tmp_sch;
   Del_String(head,tmp_sch); //??????
   OutPutTxt(head); //????? ??
   InitKey();
   break;
    }
  case 6:return 0;
  }
 
 }
  return 0;
}
void CreateTXT(LINE * &head){
 printf("/n????????????80??,Beats Monster with Fire?/n");
 printf("?? Ctrl + E (^E) ?????/n");
 LINE *p=new LINE; //????? ??????????
 head=p; //?p?? ????
 char tmp[80];
 while(1)
 {
 gets(tmp); //?????,Cheap Moncler Jackets???C?????
  // printf("%d",strlen(tmp));  
  if(tmp[0]==5)break; //?????? ^E,Coach Factory Outlet??????  
  p=p->next=new LINE;
  p->data=new char[strlen(tmp)+1];//??????? 
  strcpy(p->data,tmp);
   if(tmp[strlen(tmp)-1]==5){ //????????? ^E  
   p->data[strlen(tmp)-1]='/0';
   break;
  }
 }
 p->next=NULL; //???????????
 head=head->next;
 
}
int Count_Space(LINE * &head){ //???格?
 LINE *p=head;
 int asc_space=32; //?格?ASCIC ?值
 int count=0;
 
 do
 {  
  int Len=strlen(p->data); //???? data ?????????
  for(int i=0;i<Len;i++)
  if(p->data[i]==asc_space)count++; //???格?
 } 
 while((p=p->next)!=NULL); //?? ??
 return count;
}
int Count_Num(LINE * &head){ //???? ?
 LINE *p=head;
 int count=0;
 
 do
 {  
  int Len=strlen(p->data); //???? data ?????????
  for(int i=0;i<Len;i++)
  if(p->data[i]>=48 && p->data[i]<=57)count++; //???格?
 } 
 while((p=p->next)!=NULL); //?? ??
 return count;
}
int Count_ZM(LINE * &head){ // ?????
 int count=Count_All_Word(head); //?????????格
 int space_count=Count_Space(head); //?格?
 return count-space_count; //?????????
}
int Count_All_Word(LINE * &head){ //????????
 LINE *p=head; //????????
 int count=0; //????
 do
 {count+=strlen(p->data);} //??????????,UGG Mall??'/0'????!????????“?格????”
 while((p=p->next)!=NULL); //?? ??
 
 return count;
}
int Find_Word(LINE * &head,UGG Clearance,char *sch){ //?? sch ?????????
 LINE *p=head;
 int count=0;
 int h=0;
 int len1=0; //??????????
 int len2=strlen(sch); //?????????
 int i,j,k;
 do
 {
 len1=strlen(p->data);//???????
 for(i=0;i<len1;i++)
 { 
  if(p->data[i]==sch[0])
   {
    k=0;
    for(j=0;j<=len2-1;j++)
     if(p->data[i+j]==sch[j])k=k+1;
   if(k==len2){count++;i=i+k-1;}
   }
 }
 } 
 while((p=p->next)!=NULL); //?? ??
 return count;
}
void del_string_word(char *s,char *sch)
{
 // *s???????
 // *sch ????????
 char *p=strstr(s,sch); //????
 char tmp[80];
 int len=strlen(s);
 int i=len-strlen(p);
 int j=i+strlen(sch);
 int count=0;
 for(int k=0;k<i;k++)tmp[count++]=s[k];
 for(int kk=j;kk<len;kk++)tmp[count++]=s[kk];
 tmp[count]='/0';
 strcpy(s,tmp); //???????
}
void Del_String(LINE * &head,char *sch){ //????????
 LINE *p=head;
 do
 {
  if(strstr(p->data,sch)!=NULL)del_string_word(p->data,sch);
 } while((p=p->next)!=NULL); //?? ??
}
void OutPutTxt(LINE * &head){ //????? ??
 LINE *p=head;
 
 do
 { cout<<p->data<<endl;
 } while((p=p->next)!=NULL); //?? ??
}
void Tj(LINE * &head){ //??
  cout<<"???????????/n";
  cout<<"/n??????"<<Count_ZM(head);
  cout<<"/n?格?: "<<Count_Space(head);
  cout<<"/n?????????"<<Count_Num(head);
  cout<<"/n????????: "<<Count_All_Word(head);
 
}
Related articles?
 
  
   http://www.gxacc.cn/home.php?mod=space&uid=9008&do=blog&quickforward=1&id=138750
			
		
