Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // HomeWork_while.cpp
- //
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string block1;
- char stopSymbol;
- char symbolFind;
- cin >> block1 >> stopSymbol >> symbolFind;
- int blockNumber = 0;
- int amount = 0;
- int i = 0;
- while (i < block1.length())
- {
- while (block1[i] != stopSymbol)
- {
- char currentSymbol = block1[i];
- if (currentSymbol == symbolFind)
- {
- amount++;
- }
- i++;
- if (i >= block1.length()) break;
- }
- cout << "Block " << blockNumber << " " << symbolFind << " quantity - " << amount << endl;
- amount = 0;
- blockNumber++;
- i++;
- }
- cout << "That\' all" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement