Advertisement
Andites

Untitled

Nov 18th, 2022
90
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. int main(int argc, char* argv[])
  9. {
  10. setlocale(LC_ALL, "Russian");
  11. cout << "There are " << argc << " arguments:\n";
  12.  
  13. // Перебираем каждый аргумент и выводим его порядковый номер и значение
  14. char alf[] = { "абвгдеёжзийклмнопрстуфхцчшщъыьэюя" };
  15. int count[33]{ NULL };
  16.  
  17. for (int i = 0; i < argc; ++i)
  18. cout << i << ": " << argv[i] << '\n';
  19. for (int t = 0; t < argc; ++t) {
  20. for (int i = 0; argv[t][i] != NULL; i++) {
  21. for (int j = 0; j < 33; j++) {
  22. if (argv[t][i] == alf[j]) {
  23. count[j]++;
  24. }
  25. }
  26. }
  27. }
  28. for (int i = 0; i < 33; i++) {
  29. cout << alf[i] << " - " << count[i] << endl;
  30. }
  31.  
  32. return 0;
  33. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement