Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Kamil Roszyk 2b- zadanie maturalne- 5a
- #include <iostream>
- #include <cstdlib>
- #include <fstream>
- #include <string>
- using namespace std;
- int main()
- {
- int c, d, e, f, g, h, i, j, k, l, m, n;
- c = d = e = f = g = h = i = j = k = l = m = n = 0;
- string a;
- ifstream we("slowa.txt");
- while (getline(we, a))
- {
- int b = a.size();
- cout << b << "\t";
- switch (b){
- case 1:
- c++;
- break;
- case 2:
- d++;
- break;
- case 3:
- e++;
- break;
- case 4:
- f++;
- break;
- case 5:
- g++;
- break;
- case 6:
- h++;
- break;
- case 7:
- i++;
- break;
- case 8:
- j++;
- break;
- case 9:
- k++;
- break;
- case 10:
- l++;
- break;
- case 11:
- m++;
- break;
- case 12:
- n++;
- break;
- }
- }
- ofstream wy("wynik5a.txt");
- wy << 1 << "\t" << c << endl;
- wy << 2 << "\t" << d << endl;
- wy << 3 << "\t" << e << endl;
- wy << 4 << "\t" << f << endl;
- wy << 5 << "\t" << g << endl;
- wy << 6 << "\t" << h << endl;
- wy << 7 << "\t" << i << endl;
- wy << 8 << "\t" << j << endl;
- wy << 9 << "\t" << k << endl;
- wy << 10 << "\t" << l << endl;
- wy << 11 << "\t" << m << endl;
- wy << 12 << "\t" << n << endl;
- wy.close();
- we.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement