Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Please help!

Display a message to the user to get the user's name and birth year.
Calculate the how old they are today in years.
Display a hello message with the user's name and the user's age in years.
Place a comment at the beginning of your program with your name and date completed.

It is done in visual basic 2012 with the irvine32 library

INCLUDE Irvine32.inc
.data

inputPrompt1 BYTE "Please enter your name:  ", 0
inputPrompt2 BYTE "Enter your birth year: ", 0
outputPrompt1	BYTE "The name you entered is: ", 0 
outputPrompt2 BYTE "Your age in years is:"
nameInput  db 60 DUP(0)


.code
main PROC
	call Clrscr


	mov	 edx, OFFSET inputPrompt1
	call WriteString
	mov edx, OFFSET nameInput
	mov ecx, SIZE nameInput -1
	call ReadInt
	 

	mov edx, OFFSET outputPrompt1
	Call WriteString

	
	call Crlf
	call WriteInt
	call Crlf

	mov	 edx, OFFSET inputPrompt2
	call WriteString

	call ReadInt
	

	mov edx, OFFSET outputPrompt2
	Call WriteString
	call Crlf

	call WriteInt
	call Crlf
	
main ENDP

END main
Posted
Updated 13-Nov-13 22:15pm
v2
Comments
Richard MacCutchan 14-Nov-13 4:16am    
And what is your question? Although given that this is obvious homework, you should be asking your professor.
Member 10400490 14-Nov-13 14:29pm    
Opps I'm sorry I thought I had put the question there. The concept I'm having trouble grasping is how to make the output print the name that the user input. I just keep getting a invalid integer message. Is there a way to set the inputPrompt variable to name and then convert it to a string?
Richard MacCutchan 15-Nov-13 3:17am    
It looks like you are calling ReadInt instead of some function that reads a string.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900