Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <vector>
- #include <ctime>
- #include <algorithm>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "rus");
- srand(time(NULL));
- ofstream fout;
- int count = 0;
- string p;
- int arr[100];
- fout.open("test.txt");
- for(int i=0;i<100;i++){
- arr[i] = rand();
- fout << i+1 << " элемент: " << arr[i] << endl;
- }
- for(int i=0;i<100;i++){
- p = arr[i];
- if(p.find('5')){
- count++;
- }
- }
- fout << "Чисел содержащих цифру 5: " << count << endl;;
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement