Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : 定義主控台應用程式的進入點。
- //
- #include "stdafx.h"
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- void main()
- {
- ifstream data;
- data.open("C:\\log.txt", ios::in);
- if (!data)
- {
- cout << "Open fail\n";
- }
- string n;
- int counter=0;
- while (!data.eof())
- {
- data >> n;
- for (int i = 0; i < n.length(); i++)
- {
- if (n[i] == '3')
- counter++;
- }
- }
- cout << counter << endl;
- }
Add Comment
Please, Sign In to add comment