C code to MIPS assembly converter online code example

Example 1: C code to MIPS assembly converter online

#include <iostream>

Example 2: C code to MIPS assembly converter online

#include <iostream>  
using namespace std;  
int main(void) {  
  int n1=0,n2=1,n3,i,number,num,a,b,opt,x,y;
  cout<<"enter your option";
  cin>>opt;
if(opt==1){
 cout<<"Enter the number of elements: ";    
 cin>>number;    
 cout<<n1<<" "<<n2<<" "; //printing 0 and 1    
 for(i=2;i<number;++i) //loop starts from 2 because 0 and 1 are already printed    
 {    
  n3=n1+n2;    
  cout<<n3<<" ";    
  n1=n2;    
  n2=n3; 
 }
}
else if(opt==2) {
 
 for( a = 1; a <= 5; ++a)
    {
        for( b = 1; b <= a; ++b)
        {
            cout << "* ";
        }
        cout << "\n";
    } 

} else if(opt==3){
      cout<<"Enter X coordinate";
        cin>>x;
        cout<<"Enter y coordinate";
        
        
        //checking for quadrants and axis
        if(x==0)
            cout<< "lies on y axis";
        else if(y==0)
            cout<< "lies on x axis";
        else if(x>0&&y>0)
            cout<< "lies in 1st quadrant";
        else if(x<0&&y>0)
            cout<<"lies in 2nd quadrant";
        else if(x<0&&y<0)
            cout<<"lies in 3rd quadrant";
        else if(x>0&&y<0)
            cout<<"lies in 4th quadrant";
        else
            cout<<"lies on the origin";
        }
        return 0;   
    }

Example 3: convert c++ to mips assembly code online

# Not sure what to do now? Enter your mips code here

Tags:

Misc Example