Problem that ask to write an application that fills an array with 50 random integers,loop through the array,displaying each value, and count the number of negative values;after the loop finishes display the count. Note: The Random32 procedure from the Irvine32 library generates random integers.

*I honestly don't know where to start*

1- Make an array, define the size of it
2- for 1 to end of array, generate a number, place it in the array relating to current index
3- another for loop, with a "negative counter" variable which keeps the number of negative numbers you read.
4- print the negative counter.

Can you show me some code?

I think you should try to code it yourself and then put it here, and ask for help if needed. I already provided you the general procedure. Please do not expect the code to be written for you without any struggle from you.

Yeah I tried I called the Random32 procedure and the Randomize Procedure in a loop. I don't have my laptop so when I get a chance I'll post what I got

my .code section was something like this

L1: Call Random32

Call Randomize

loop L1

in my .data section all I really did was move 50 to ECX

Sorry I'm really bad with arrays

This is all I got

myArray DWORD ?

main PROC
    call Randomize
    mov myArray,EAX
    mov ECX, 50
    jmp L1

    call Random32
    call WriteInt

    loop L1


main ENDP

END main

note I'm doing this in MASM.

commented: output of this code +0
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.