Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Author : H. M. Tarek Ullah
- Date : 02.03.15
- About : this program identifies identifiers of any equation
- */
- #include<bits/stdc++.h>
- using namespace std ;
- bool isoperator(string s)
- {
- for(int i=0 ;i<s.length();i++)
- {
- if(s[i]=='+' || s[i]=='=' || s[i]=='-' || s[i]=='/')
- return true ;
- else if(s[i] >= '0' && s[i]<='9')
- return true ;
- else
- return false ;
- }
- }
- int main()
- {
- string eqn ;
- getline(cin,eqn);
- string r1 ;
- stringstream os(eqn) ;
- vector<string> vec ;
- while(os>> r1 || !os.eof()){
- vec.push_back(r1);
- }
- vector<string>::const_iterator it1= vec.begin() ;
- vector<string>::const_iterator it2=vec.end() ;
- for(vector<string>::const_iterator it=it1;it!=it2;it++)
- {
- string s = *it ;
- if(isoperator(s)==false)
- cout << *it << endl;
- }
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement