0

okay guys im really stuck on this and i need help badly. All i know is that i need a loop at the begining to ask for four different marks, these marks have to be between 0-100. the marks are then stored in array and then i do a sum such as SAR EAX,2 to work out the average mark.

If you guys could help that would be great!

Hees some code snippets i have already

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <stdafx.h>

int main (void)
{
	int mark1[] = "Enter the Mark for Module:";
	char average[] = "The average mark is:";
	char format[] = "%d"; 

	int myarray[4]; 
	myarray[0] = test1; 
	myarray[1] = test2; 
	myarray[2] = test3; 
	myarray[3] = test4; 

	_asm {
	mov ecx,4 
	mov eax,0 
	mov ebx,0 
	Loop1: add eax,myarray[ebx] 		
	add ebx,4
	loop Loop1
	... }
}
 Sleep(99999999);
return 0;
}

Thanks,

~Crag

2
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by Cragsterboy
0

Why are you dropping into assembly? Why not just use the C++ arithmetic operators and loop statements?

0

because its my homeowrk to do it in assembly and this is why im getting stuck lol

Just realised i posted in the wrong forums, my bad!

Edited by Cragsterboy: n/a

0

I see. I'm afraid I can't help you with assembly. I've flagged the thread for the mods. They'll move it to the assembly forum for you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.