Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int main()
- {
- char sym;
- int n, amount = 0;
- cout << "Enter size of string: ";
- cin >> n;
- char *str = new char[n];
- cout << "Enter string: ";
- cin >> str;
- cout << "Enter symbol: ";
- cin >> sym;
- for (int i = 0; i < n; i++)
- {
- if (str[i] == sym) amount++;
- }
- cout << "Amount: " << amount << endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement