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

Recommended Answers

All 4 Replies

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

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!

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.

okay cheers anyway :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.