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 assembly code for the following C procedure: i = 1; sum = 0; while (i...
Write assembly code for the following C procedure: i = 1; sum = 0; while (i ≤ n) { sum += i; ++i; } i and sum corresponds to $s1 and $s2. n is preloaded into $s3
Write a decorator function that has the following property: 1.  The name of a decorator is uppercase...
Write a decorator function that has the following property: 1.  The name of a decorator is uppercase and takes a function as input. 2.  The decorator has an inner function called wrapper with no input argument. 3.  The wrapper function has two local variables: original and modified. 4.  The input function argument of decorator gets assigned to the original variable inside the wrapper function and the upper case version of the input function gets assigned to the modified variable. 5.  The wrapper function returns the...
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.
Write a program in MIPS Assembly. This program will ask the user to enter 20 numbers....
Write a program in MIPS Assembly. This program will ask the user to enter 20 numbers. The program will store these numbers in an array in memory (sequential memory locations). It will then print out the list of numbers in three different formats: The numbers will be printed each on a separate line. The numbers will be printed on a single line, with spaces between the numbers. The program will ask the user to enter a number n. The program...
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)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT