1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
std::string sonad[350];
int i=0,koht=0;
int k=0;
int loendur[350];
FILE *fp,*fpp,*fppp;
char *pnt;
char abi[200];
char abi2[40];
std::string uksikudSonad[350];
char mark;
fp = fopen("Teaduskond.txt","r");
fpp = fopen("Storage.txt","w");
while(!feof(fp)){
fgets(abi,200,fp);
koht=0;mark=abi[koht];
do{
mark=abi[koht++];
switch(mark){
case '.': fprintf(fpp," ");break;
case 'ü': fprintf(fpp,"u");break;
case 'õ': fprintf(fpp,"o");break;
case 'ä': fprintf(fpp,"a");break;
case 'ö': fprintf(fpp,"o");break;
}
if(isalnum(mark)){
fputc(mark,fpp);
}
if(isspace(mark)){
fputc(mark,fpp);
}
}while(mark);
}
fclose(fp);
fclose(fpp);
fppp = fopen("Abi.txt","w");
fpp = fopen("Storage.txt","r");
while(!feof(fpp)){
fgets(abi,200,fpp);
pnt = strtok(abi," 0123456789");
while(pnt != NULL){
fprintf(fppp,"%s\n",pnt);
pnt = strtok (NULL, " 0123456789");
}
}
fclose(fppp);
fclose(fpp);
fppp = fopen("Abi.txt","r");
while(!feof(fppp)){
fgets(abi2,40,fppp);
sonad[i] = abi2;
i++;
}
fclose(fppp);
for(int j=0;j<216;j++){ // TEMP
std::cout << sonad[j]; // TEMP
} //TEMP
for(int i=0;i<=216;i++){ //This loop goes through the list with all words
for(int j=0;j<=sizeof(uksikudSonad)/sizeof(int);j++){
if(sonad[i]==uksikudSonad[j]){ //if the word is in 1st list for more than once
loendur[j]++; //adding 1 to the count of the word that is present for more than once
break;
}
k=j; // to add the word that is first seen to the 2nd list
}
uksikudSonad[k]=sonad[i]; // adding the new word
}
printf("\nVajuta suvalist klahvi...");
getch();
return 0;
}
|