Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define LL long long
- void Operator() {
- //getchar();
- cout<<"\nEnter the String: ";
- char s[20];
- gets(s);
- cout<<"\n"<<"Output: \n";
- int i=0;
- while (s[i] != '\0') {
- switch (s[i]) {
- case '=':
- if(s[i+1]=='='){
- cout<< s[i]<<s[i] << " :equal to operator"<<"\n";
- i+=2;
- }
- else{
- cout<< s[i] << " :simple assignment operator"<<"\n";
- i++;
- }
- break;
- case '+':
- if(s[i+1]=='+'){
- cout<< s[i]<<s[i] << " :increment operator"<<"\n";
- i+=2;
- }
- else{
- cout<< s[i] << " :addition operator"<<"\n";
- i++;
- }
- break;
- case '-':
- if(s[i+1]=='-'){
- cout<< s[i]<<s[i] << " :decrement operator"<<"\n";
- i+=2;
- }
- else{
- cout<< s[i] << " :subtraction operator"<<"\n";
- i++;
- }
- break;
- default:
- //printf("\n Not a operator");
- i++;
- }
- }
- }
- int main()
- {
- cout<<"Take input multi time: ";
- int tc;
- cin>>tc;
- getchar();
- while(tc--){
- Operator();
- }
- return 0;
- }
- /*
- int y = a+b;
- y++;
- if(x==m && x==n) y=y-1;
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement