answersLogoWhite

0


Best Answer

int countVowels(const char* str) {

int i = 0;

int numVowels = 0;

while(str[i] != '\0') {

switch(str[i]) {

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

++numVowels;

}

++i;

}

return numVowels;

}

static int countVowels(String str) {

int numVowels = 0;

foreach(char ch in str) {

switch (ch) {

case 'a':

case 'e':

case 'i':

case 'o':

case 'u':

++numVowels;

break;

}

}

return numVowels;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

Set a counter variable to zero

Loop through the string one character at a time until the end

Check if the letter is "A" If it is, increment a counter and skip to NextLoop.

Check if the letter is "E" If it is, increment a counter and skip to NextLoop.

Check if the letter is "I" If it is, increment a counter and skip to NextLoop.

Check if the letter is "O" If it is, increment a counter and skip to NextLoop.

Check if the letter is "U" If it is, increment a counter

Label: NextLoop (skip to here)

end of the loop

display the counter

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How would you write a program that counts the number of vowels in a string in assembly language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

An assembly language program that will take three decimal input and display minimum of them?

program that take three decimal number as input and find the largest among them in assembly language


Could you write a assembly language program in tasm To check whether a given number present in a sequence of given memory location containing the string to be checked in 8086?

8086 assembly language program to check wether given number is perfect or not


How do you write a program using function that counts the number of vowels in a string in java language?

Use text-editor notepad++


Program to count the number of numbers in an array using 8085 microprocessor?

A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.


Write a program using 8086 instructions to double a number?

There isn't a reason to write a complete program to do this; in any assembly language just shift the value 1 bit to the left to double it.


A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


Write an assembly language program to multiply an 8-bit signed number by a 8-bit signed number?

MVI A, 30h MVI B 20h MUL A,B OUT port1 HLT


Write a program in 8086 assembly language that accepts two input characters pack two characters in one word and store them in consecutive locating in a memory buffer The first address of buffer is 400?

develop and test an assembly language to convert a two digit BCD number to binary


How do you store a 128 bit number in memory in assembly language?

yes


What do you mean by computer Assembly?

This can mean one of two different things depending on context. The obvious one is the physical assembly of a computer, but since you're asking here, I assume you're asking about assembly language. The CPU inside your computer can only understand a limited set of relatively simple instructions. These instructions are represented by numbers, and the CPU knows which number means which instruction. Assembly language is a human readable representation of the instructions that the CPU can understand. Instead of a large number, a short word or acronym called a mnemonic is used. When an assembly program is written, a program called an assembler can translate each mnemonic into the number that represents it. Each mnemonic corresponds to one instruction that the CPU will follow.


How does the assembly language can be executed by CPU?

Assembly language programs are the Low level programs. We write Assembly Language program in basically 8085 and 8086 microprocessors.We can have several registers to do opreations with. Accumulator is one most important Register in a assembly program.We use several instructions like..Arithmetic:INR - Increment AccumulatorADD B - Add Content of Reg. B with AccumulatorSUB, etc.Logical:AND - Bitwise ANDJump Instriction:JZ label - Jump to label if ZERO flaggedJC Label - Jump on CarryEtc..Example:MVI B, 06 //Load Register B with the Hex value 06MOV A, B //Move the value in B to the Accumulator or register AMVI C, 07 //Load the Register C with the second number 07ADD C //Add the content of the Accumulator to the Register CSTA 8200 //Store the output at a memory location e.g. 8200HLT //Stop the program execution


How do you write an assembly language program to count the number of ones in a given byte?

1. Find algorithm.2. Implement it.Hint: if a non-zero N number has K 1-bits, then (N AND N-1) has K-1 1-bits.