Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- void main()
- {
- string temp;
- ifstream input("E:/input.txt");
- bool finddou=false,findco=false,findcom=false,findsin=false;
- int co=0,com=0;
- while(getline(input,temp))
- {
- cout<<temp<<endl;
- for(int i=0;i<temp.length();i++)
- {
- if(temp[i]=='"' && findcom==false && findco==false && findsin==false)
- {
- if(finddou==true)
- {
- finddou=false;
- continue;
- }
- finddou=true;
- }
- if(temp[i]=='\'' && findcom==false && findco==false && finddou ==false)
- {
- if(findsin==true)
- {
- findsin=false;
- continue;
- }
- findsin=true;
- }
- if(temp[i]=='/' && temp[i+1]=='*' && finddou==false && findcom==false && findsin==false)
- {
- findco=true;
- }
- if(temp[i]=='*' && temp[i+1]=='/' && findco ==true)
- {
- co++;
- findco=false;
- }
- if(temp[i]=='/' && temp[i+1]=='/' && finddou==false && findsin==false && findco ==false)
- {
- com++;
- }
- }
- }
- cout << com << endl << co;
- cin >> temp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement