Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <conio.h>
- #include <iomanip>
- #define N 128
- using namespace std;
- int main()
- {
- ifstream file1("text.txt");
- char A, W[N];
- int a=0, b=0;
- double r;
- while(! file1.eof())
- {
- A=file1.get();
- if((A>=65 && A<=90) || (A>=97 && A<=122) || (A>=128 && A<=175) || (A>=224 && A<=247)) a++;
- }
- file1.close();
- ifstream file2("text.txt");
- while(! file2.eof())
- {
- file2 >> W;
- cout << W << ' ';
- b++;
- }
- file2.close();
- cout << "\nSymvol: " << a;
- cout << "\nSlov: " << b;
- r=a/b;
- cout << fixed << setprecision(7) << "\nSerednya kil'kist' symvolov na slovo: " << r;
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment