Hi everyone
i am new here
and i have problem with my project
this is the project

Use x86 assembly language to write a program that works as a following:
1) When the program is executed, it asks the user to enter a password
2) If the entered password matches, then the program ask the user to enter a statement
3) The statement length is up to 100 characters
4) The statement characters should include only alphabet (capital or small) letters and sp
5) Then, the program should do the following:
• Display number of words in the statement
• Display number of letters in the statement
• Display number of capital and small letters in the statement
• Display the longest word in the statement
• Display the shortest word in the statement
For example, if the user enters the following sentence:
"This is a computer organization course"
The output of the program will be:
The number of words in this statement is: 6
The number of letters in this statement is: 33
The number of capital letters in this statement is: 1
The number of small letters in this statement is: 32
The longest word in this statement is: organization
The shortest word in this statement is: a

Use TASM only

Dani AI

Generated

Assuming a DOS/TASM environment (since TASM was specified) — next steps after the password routine are: read the statement into a 100-byte buffered input, validate characters, then parse to count words/letters/capitals/smalls and to extract longest/shortest words. asked about platform; the following uses DOS Int 21h AH=0Ah input buffer (declare: inputBuf db 100,0,100 dup(0)). already has the password input; the parser below plugs in after a successful password check. : a simple menu can be added later by reading one key (AH=01) and jumping to print routines.

Implementation outline (important details)

  • Use the DOS buffered read: after int 21h the byte at inputBuf+1 is the character count and the characters start at inputBuf+2.
  • Validate every character: allow only A..Z, a..z, or space (' '); on any other byte, reject and re-prompt.
  • Maintain: wordCount, letterCount, capCount, smallCount, currentLen, longestLen, shortestLen (init shortestLen to 255). Track wordStart (pointer) when entering a word.
  • Parsing rule: treat any sequence of letters as a word. Consecutive spaces are one separator. When a space follows a word, finalize that word: update counts, compare lengths and copy the word to longest/shortest buffers if needed. After the loop finalize if the input ends in a letter.
  • Tie policy: keep the first longest/shortest when lengths tie.

Compact TASM-style parsing sketch

; data: inputBuf db 100,0,100 dup(0)
; longest db 101 dup(0) ; shortest db 101 dup(0)
; counters: wordCnt dw 0, letterCnt dw 0, capCnt dw 0, smallCnt dw 0

; after int 21h (AH=0Ah):
    mov si, OFFSET inputBuf+2    ; pointer to first char
    mov cl, [inputBuf+1]         ; remaining chars
    xor bx,bx                    ; BX = current word length
    xor dx,dx                    ; flags/indices

parse_loop:
    cmp cl,0
    je finalize_last_word
    mov al,[si]
    inc si
    dec cl
    cmp al,' '
    je handle_space
    cmp al,'A'
    jb invalid_char
    cmp al,'Z'
    jbe is_upper
    cmp al,'a'
    jb invalid_char
    cmp al,'z'
    ja invalid_char
is_lower:
    inc smallCnt
    inc letterCnt
    inc bx
    jmp parse_loop
is_upper:
    inc capCnt
    inc letterCnt
    inc bx
    jmp parse_loop

handle_space:
    cmp bx,0
    je parse_loop     ; skip extra spaces
    ; finalize: inc wordCnt, compare bx with longestLen/shortestLen
    xor bx,bx
    jmp parse_loop

invalid_char:
    ; print error and re-read input

Testing / debugging tips: verify DS points to your data segment before int 21h, print intermediate counter values while testing, and test edge cases (leading/trailing spaces, multiple spaces, empty input). For , implement a tiny menu using int 21h AH=01 (single-char input) to select which results to print.

Recommended Answers

All 5 Replies

So what part do you actually need help with?

Which platform?

If Windows, DOS or GUI?

Most importantly show something of the source as you understand it should be done

So what part do you actually need help with?

Which platform?

If Windows, DOS or GUI?

Most importantly show something of the source as you understand it should be done

ok!
i did the first part which is to ask the user to enter password
and this is my code

ok!
i did the first part which is to ask the user to enter password
and this is my code

here is the code

Pleaze............. there is no one can help me!!!!!!!!!

hey i want the same code but with a list to choos what the user want print

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.