Write the C code below in Assembly Language include include
Write the C++ code below in Assembly Language.
#include <iostream>
#include <string>
int fact(int n){
if(n==1 || n==0){
return 1;
}else{
return n*fact(n-1);
}
return n;
}
int main()
{
std::cout<<\"Factorials 1-9\ \";
for(int i =0; i<=9;i++){
std::cout<<i<<\" \"<<fact(i)<<\"\ \";
}
}
Solution
you can compile it as : g++ -S myfile.cpp
This will generate myfile.S with code of c++ converted to assembly code.
