Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For Assembly (MASM 32-bit using VS17 Community)... So I want to generate a rando

ID: 3849956 • Letter: F

Question

For Assembly (MASM 32-bit using VS17 Community)...

So I want to generate a random string, in which the length of the string is defined by the user (n).

Using Randomize and RandomRange from the Irvine32 library, I want to generate random numbers within the range displayed on the ASCII table for uppercase letters (65-90).

After that, I want to create another procedure called StringPrint (which uses writechar) to convert and output into string chars.

This is the code I have so far...

INCLUDE c:IrvineIrvine32.inc


ExitProcess proto,dwExitCode:dword

.data      
prompt byte "Please enter a number between 1 and 50: ",0dh,0ah,0
prompt2 byte "The generated string is... ",0dh,0ah,0
space byte " ",0
n dword ?
rangeup dword ?
.code
main proc
mov ebx, 65
mov eax, 90
mov rangeup, eax

mov edx, offset prompt
call WriteString
call ReadInt
mov n, eax

call Crlf
mov edx, offset prompt2
call WriteString

call Randomize
mov ecx, n
L1:
pushad                                          ;//save all 32bit registers
call GenerateNumbers
call WriteInt
mov edx, offset space
call WriteString
popad                                           ;//restore all 32bit registers
loop L1


call Crlf
call Crlf
invoke ExitProcess, 0
main endp

GenerateNumbers proc
add rangeup, ebx
call randomrange
sub rangeup, ebx
ret
GenerateNumbers endp

end main

Explanation / Answer

#include <stdio.h>
int main()
{
char s[1000], i;
printf("Enter a string: ");
scanf("%s", s);
for(i = 0; s[i] != ''; ++i);
printf("Length of string: %d", i);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote