Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- const int N = 10; // натуральное число N, можно менять
- char mas[N] = {'*','-','d','*','q','3','+','*','!',')'}; // Массив символов
- int count_star = 0;
- int count_plus = 0;
- for (int i = 0; i < N; ++i) { // Перебираем массив символов
- if (mas[i] == '*') ++count_star; // Увеличиваем счетчик звездочек
- if (mas[i] == '+') ++count_plus; // Увеличиваем счетчик плюсов
- }
- cout << "Count of '*' = " << count_star << endl; // Выводим на экран получившиеся значения
- cout << "Count of '+' = " << count_plus << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement