DIS MACRO STR
MOV AH,09H
LEA DX,STR
INT 21H
ENDM
DATA SEGMENT
MSG1 DB \"ENTER YOUR STRING : $\"
MSG2 DB \"Saving....\"
MSG3 DB \"A : uppercase vowel"
MSG4 DB \"B: lowercase vowel\"
MSG5 DB \"C: uppercase consonant\"
MSG6 DB \"D: lowercase consonant\"
MSG7 DB "Enter your choice $"
msg_wrong db 10, "Please enter correct choice
$"
STR1 DB 20 DUP(\'$\')
LINE DB 10,13,\'$\'
DATA ENDS
CODE SEGMENT
ASSUME
DS:DATA,CS:CODE
main:
MOV AX,DATA
MOV DS,AX
DIS MSG1
MOV AH,0AH
LEA DX,STR1
INT 21H
DIS LINE
MOV CH,00
MOV CL,BYTE
PTR[STR1+1]
LEA SI,STR1+2
DIS MSG3
DIS MSG4
DIS MSG5
DIS MSG6
DIS MSG7
MOV AH,0AH
LEA DX,STR1
INT 21H
L1: MOV AH,BYTE PTR[SI]
CMP AH,\'A\'
JL L4
CMP AH,\'Z\'
JG L2
ADD BYTE
PTR[SI],32
JMP L3
L2:CMP AH,\'a\'
JL L4
CMP AH,\'z\'
JG L4
SUB BYTE
PTR[SI],32
L3:INC SI
LOOP L1
DIS MSG2
DIS STR1+2
L4:MOV AH,4CH
INT 21H
jmp cs:jmptble
[bx]
;jumptable
jmptble dw caseA,caseB,caseC ; caseDcases
check:
lea
dx,msg_wrong ;Display
wrong choice
mov
ah,9h
int 21h
mov
dl,10
;Move to new line
mov ah,2h
int 21h
jmp
main
;Loop again to get correct choice
caseA:
;CaseA- Uppercase vowel
mov
dl,10
;move to new line
mov ah,2h
int 21h
mov
al,num1
;copy num1 to al
xor
ah,ah
;empty ah to zero
add
al,num2
; add num2 to al
call display
jmp
endlabel
;jum to endlabel
case1:
;Case1 for subtraction
mov
dl,10
;;Move to new line
mov ah,2h
int 21h
mov
cl,num1
;Copy number1 to cl
cmp
cl,num2
;check if first numbr is smaller than second
jl
verify
;jump if num1 is less than num2
mov
al,num1
;copy num1 to al
xor
ah,ah
;empty the uper portion of ax
sub
al,num2
;subtract two nmbers
call display
jmp endlabel
case2:
mov dl,10
mov ah,2h
int 21h
mov al,num1
xor ah,ah
adc
al,num2 ;adc add 1 value to the sum (if
carry flag is 1)
call display
jmp endlabel
verify:
lea dx,msg_verify
mov ah,9
int 21h
display:
mov
dl,10
;mov dl,10 to divide result in ax
div
dl
;Dvide ax by 10
mov
dl,al
;copy quotient to dl
mov
bl,ah
;copy remainder to bl
add
dl,30h
;add 30h to get actual number
mov
ah,2h
;Service # to display character
int
21h
;Call OS to do the job
add
bl,30h
;add 30h to remainder
mov
dl,bl
;move to dl to display
mov
ah,2h
;Service # to display character
int
21h
;Call OS to do the job
ret
endlabel:
mov ah,4ch
int 21h
end main
Write a ALP that inputs a string and let's the user choose from uppercase or lowercase...
Can you write a program to convert a string from uppercase to lowercase and lowercase to uppercase depending on the user's input? In simple C++ please So for example if the input is Hello then the output should be hELLO
2. Searching a String: Write a MIPS assembly language program to do the following: Read a string and store it in memory. Limit the string length to 100 characters. Then, ask the user to enter a character. Search and count the number of occurrences of the character in the string. The search is not case sensitive. Lowercase and uppercase letters should be equal. Then ask the user to enter a string of two characters. Search and count the number of...
Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the user to enter a string which is subsequently displayed in uppercase. It is important to first ensure that string to be converted is in the a-z range. The program does not recognize any space, symbols or any kind of punctuation marks. Any time the user enters any of this character the program is going to repeatedly ask for...
Write a C program to “de-vowel” an input string. Assume that the user provides input containing only the characters a through z (i.e., all lowercase letters). Your program should create an output string that deletes all vowels from the input string, pushing the letters together to fill any gaps. For example, given the input “theturtleandthehare” your code should print out “thtrtlndthhr”. Your program should create an output string from the input string, before printing its output. Sample Input: Enter a...
Write a program that inputs a string from the user representing a password, and checks its validity. A valid password must contain: -At least 1 lowercase letter (between 'a' and 'z') and 1 uppercase letter (between 'A' and 'Z'). -At least 1 digit (between '0' and '9' and not between 0 and 9). At least 1 special character (hint: use an else to count all the characters that are not letters or digits). -A minimum length 6 characters. -No spaces...
Write a C program that prompts the user for an input string with all lowercase letters. Your program should then sort the characters in the string and print the sorted string. Assume that the string contains no spaces and has at most 30 lowercase characters. Your program should loop continually until the user enters “q” to quit.
Write a program which gives the user the option to separate, Vowels or Consonant from a given text from a file. We will display the separated data on screen and also store it in output file. This is for C++ . Name of the input file to be used is: SeparateConVow.dat . The input file has this sentence: THIS IS THE FINAL PROJECT FOR OUR CLASS . The code should separate the vowels and consonants in that sentence. ^ ....
Write a program(Python language for the following three questions), with comments, to do the following: Ask the user to enter an alphabetic string and assign the input to a variable str1. Print str1. Check if str1 is valid, i.e. consists of only alphabetic characters. If str1 is valid Print “<str1> is a valid string.” If the first character of str1 is uppercase, print the entire string in uppercase, with a suitable message. If the first character of str1 is...
Write a C++ program to get an input string from the user, and output the string in uppercase letters. Use a dynamic character array to store the string. ?(this can be from any input file, there is no specific file.)
2) Write a function stringManip that takes in a character string and returns a character string following these rules: a) any vowel (a, e, i, o, u) is replaced by the character '&' b) any numeric character has 1 added to it (if it was 9, it becomes O instead) (str2num() is useful here) c) all lowercase characters become uppercase d) replace the final character with '!' e) append the length of the string before this step to the end...