0

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*

2
Contributors
6
Replies
10
Views
6 Years
Discussion Span
Last Post by jwill222
0

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.

0

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.

0

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

0

This is all I got

INCLUDE Irvine32.inc
.data
myArray DWORD ?

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

L1: 
    call Random32
    
    call WriteInt

    loop L1



    

    
    exit
main ENDP

END main

note I'm doing this in MASM.

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.