Question

In: Computer Science

Write assembly programs with the following I/O Enter a sentence: Project No Three. No. of uppercase...

Write assembly programs with the following I/O

Enter a sentence: Project No Three.

No. of uppercase letters = 3

No. of lowercase letters = 11

You can use c++ for the Inputting and outputting

Solutions

Expert Solution

//If you have any doubts please comment me

//I wrote c++ code only.....

//If you like my answer please Upvote

Code:

// c++ code for counting number of captial letters and lower case letters
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
   char arr[200];//this is for to take sentence
   int upper_case=0,lower_case=0; //these variables for to store how many upper cases and lower cases..
   cout << "Enter a sentence: "<<endl;
   int i;
    gets(arr);
    //Here we have to count number uppercase and lower case letters..


          while(arr[i]!=0){
      
      
         if(arr[i] >= 'A' && arr[i] <= 'Z')//Here we check wether the letter is upper case or not
       {
           
         upper_case++;//if it upper case we increase the count
         i++;
       
         }

         else if (arr[i] >= 'a' && arr[i] <= 'z')//Here we check the lower case letter condition
       {
          lower_case++;//if it is lower case we increase lower_case
          i++;
        
         }
         else
         {
            i++;
       }
}

   //Now here print the values...
   cout << "No.of Uppercase letters= " << upper_case << endl;

    cout << "No.of Lowercase letters= " << lower_case<< endl;
  
}

Output:


Related Solutions

Assembly code Write an assembly program that converts all uppercase letters to their corresponding lower cases....
Assembly code Write an assembly program that converts all uppercase letters to their corresponding lower cases. meanwhile all characters that are not upper case letters should remain unchanged. Hint: ASCII: a = 97, z = 122, A = 65, Z = 90 String : "Riders On The Storm - The Doors"
Write an interactive C program that asks a user to enter a sentence from the keyboard,...
Write an interactive C program that asks a user to enter a sentence from the keyboard, and prints the sentence with all the words spelled backwards. Note: you may assume that each sentence will have at most 50 characters and each word is separated by a space. Sample code execution: bold information entered by user enter a sentence: hello ece 175 class olleh ece 571 ssalc continue (q to quit)? y enter a sentence: May the force be with you...
Write MIPS assembly code for the following C code. for (i = 10; i < 30;...
Write MIPS assembly code for the following C code. for (i = 10; i < 30; i ++) { if ((ar[i] > b) || (ar[i] <= c)) ar[i] = 0; else ar[i] = a; }
Write a mips assembly language program to ask the user to enter two integers A and...
Write a mips assembly language program to ask the user to enter two integers A and B and then display the result of computing the expression: A + 2B - 5.
Write a mips assembly language program that asks the user to enter an unsigned number and...
Write a mips assembly language program that asks the user to enter an unsigned number and read it. Then swap the bits at odd positions with those at even positions and display the resulting number. For example, if the user enters the number 9, which has binary representation of 1001, then bit 0 is swapped with bit 1, and bit 2 is swapped with bit 3, resulting in the binary number 0110. Thus, the program should display 6.
Write a mips assembly code program that ask the user to enter an integer value, and...
Write a mips assembly code program that ask the user to enter an integer value, and then print the result of doubling that number.
I am using MIPS assembly with MARS. My question is about I/O Devices. 1) Research and...
I am using MIPS assembly with MARS. My question is about I/O Devices. 1) Research and read about SFRs. Explain the differences between TRISx, PORTx, LATx and ODCx ports. Specify the special function registers (SFRs) for the I/O device(s)
Write a mips assembly language program that asks the user to enter an alphabetic character (either...
Write a mips assembly language program that asks the user to enter an alphabetic character (either lower or upper case)and change the case of the character from lower to upper and from upper to lower and display it.
Complete the sentence, "I feel health when..". Write 300 words
Complete the sentence, "I feel health when..". Write 300 words
****NOTE YOU MUST USE SYSTEM CALL I/O, meaning STANDARD I/O IS NOT ALLOWED Write a C...
****NOTE YOU MUST USE SYSTEM CALL I/O, meaning STANDARD I/O IS NOT ALLOWED Write a C program using system call I/O to determine how many lines there are in a text file.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT