ok... so i've written this in C, and it has no errors or any warnings, but i need the assembly version for it.... do you think you could help?
//the program calculates a sum, average, and standard deviation of 5 numbers from the keyboard, then calculates a sum+/- interval and all values outside the interval are considered and shown as aberrant values:
#include %26lt;stdio.h%26gt;
#include %26lt;math.h%26gt;
void main()
{int i;
float v[5], sum=0.0, avg;
double m, n, ds;
double Calc=0.0;
printf("Give 5 numbers:");
for(i=1;i%26lt;=5;i++)
scanf("%f",v[i]);
for (i=1;i%26lt;=5;i++)
sum+=v[i];
avg = sum / 5;
for(i=1;i%26lt;=5;i++)
Calc += ( v[i] - avg) * ( v[i] - avg);
ds = sqrt((double)Calc/5);
m= avg + ds;
n= avg - ds;
printf("\nSum=%f", sum);
printf("\nAverage=%f", avg);
printf("\nStandard Deviation=%f", ds);
printf("\nBeginning of interval=%f", n);
printf("\nEnd of interval=%f", m);
for (i=1; i%26lt;=5; i++)
if (v[i]%26gt;m||v[i]%26lt;n)
printf("The value %f is an aberrant value!\n", v[i]);
}
Could anyone please help me turn this program from C to assembly language?
Look, there's a shortcut you know. I'm using GCC. I have been since about 2005 when I jumped onto Linux full time (actually, I started using GCC about 1994 but I used other compilers too till I jumped. When i do gcc -S filename.c I get a filename.s which is an assembly language program of your file. Compilers ALL have command line interfaces and they ALL have switches which allow you to end up with assembly language. From personal experience I can say Visual C++ as late as 5.0 did. So, find out what the switches are for your compiler and run it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment