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 5276KB
stdin
      add  $t0, $zero, $a0    
loop: 
      lw   $t1, 0($a1)
      nop                         
      lw   $t2, 4($t1)
      add  $t3, $t0, $a2
      bne  $t2, $t3, skip
      nop
      add  $t4, $t2, $t4
skip: 
      addi $t0, $t0, -1
      addi $a1, $a1, 4
      bne  $0, $t0, loop
      nop
      and  $v0, $t4, $t4
stdout
Enter Mips:        add  $t0, $zero, $a0    poop