Assembler Developer

Moderators: None (Apply to moderate this forum)
Number of threads: 960
Number of posts: 1752

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
need LCS in mips assembly, already have C++ Posted by sepideh1983 on 22 Feb 2012 at 1:34 PM
HI everyone, i need to have the Longest common substring code in mips assembly. later on i will write an assembler for that. now I have the c++ code, but have no idea what the assembly code will be


#include <iostream>

#include <string>



using namespace std;

int main () {



string first, second, lcsub, max;



cout << "Enter two words" << endl;

cin >> first >> second;

for (int i=0; i < first.length(); i++)

for (int j=0; j < second.length(); j++)

for (int k=1; k <= first.length() && k <= second.length(); k++){

if (first.substr(i,k) == second.substr(j,k)){

lcsub = first.substr(i,k);

}

else{

if (lcsub.length() > max.length())

max=lcsub;

lcsub="";

}

}

if (lcsub.length() > max.length())
max=lcsub;

lcsub="";


cout << "Longest Common Substring: " << max << endl;

return 0;
}




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.