Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- void main()
- {
- string line;
- ifstream Fin; // поток ввода
- ofstream Fout; // поток вывода
- Fin.open("C:\\Users\\User\\Desktop\\text.txt");
- Fout.open("C:\\Users\\User\\Desktop\\OutputText.txt");
- char symbol = 'а';
- int withoutThatSymbol = 0, currentPosition;
- while (getline(Fin, line))
- {
- currentPosition = 0;
- withoutThatSymbol++;
- while (line[currentPosition] == ' ' && line[currentPosition] != '\0')
- currentPosition++; //Проходит пробелы в начале строки
- while (line[currentPosition] != '\0')
- {
- if (line[currentPosition] == symbol)
- {
- withoutThatSymbol--;
- break;
- }
- currentPosition++;
- }
- }
- Fout << withoutThatSymbol << endl;
- cout << withoutThatSymbol << endl;
- Fin.close();
- Fout.close();
- cin.get(); cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment