fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11. vector<string> words;
  12. string mips;
  13. cout << "Enter Mips: ";
  14. getline(cin, mips);
  15.  
  16. cout<< mips;
  17. string temp;
  18. char c;
  19.  
  20. for(int i = 0; i<mips.size(); i++)
  21. {
  22. if(((mips[i] != ',')||(mips[i] != ' ') || (mips[i] != '(')||(mips[i] != ')')))
  23. {
  24. temp+= mips[i];
  25. }
  26. else if(((mips[i] = ',')||(mips[i] = ' ')) && !temp.empty())
  27. {
  28. words.push_back(temp);
  29. temp.clear();
  30. }
  31. else if((mips[i] = '(')||(mips[i] = ')'))
  32. {
  33. temp+=mips[i];
  34. words.push_back(temp);
  35. temp.clear();
  36. }
  37.  
  38. }
  39.  
  40.  
  41. for(int i = 0; i < words.size();i++)
  42. {
  43. cout << words[i] << endl;
  44. }
  45.  
  46. cout << "poop" <<endl;
  47. return(0);
  48. }
Success #stdin #stdout 0.01s 5284KB
stdin
add $s0, $t2, $s0
stdout
Enter Mips:  add $s0, $t2, $s0poop