x86 Assembly MASM Make two different files PrnIntReverseSum.asm and CountWord.as
ID: 3806768 • Letter: X
Question
x86 Assembly MASM
Make two different files PrnIntReverseSum.asm and CountWord.asm.
I am using Microsof Visual Studio C++ for MASM.
Provide the entire codes with some comments of what is happening inside thr program and headers such as .code or .data. Using irvine library is allowed to make operations easier my instructor said.
Part 1: PrnIntReverseSum 150 pointsl: You program will ask the user to enter an integer saying, "How many integer do you want to enter?" Once the user enters the number (count), you will prompt the user to enter integer repeatedly for that many times, saying, "Enter Integer Number 1" "Enter Integer Number 2" and so on. Once all the expected integer numbers are given, you will print the user-entered numbers in reverse order saying, "These are the numbers in reverse order: 99 and then print the sum of the numbers saying, "The sum of the given numbers is: Part 2: CountWord 150 points l: You program will ask the user to enter a string. Once the user enters the string and presses enter, you program will read the string and count the number of words in that string. Then, your program will print the number of words found in that string. Output example: Your program: Enter your string: User: I like assembly language programming. Press enter Your program: Your entered string had 4 words Your program: Repeat (Y/N)?Explanation / Answer
part a:
code:
#include<iostream>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
int main()
{
int n;
cout<<"how many integers you want to enter"<<endl;
cin>>n;
int i=1;
vector<int> arr;
while(i<=n)
{
cout<<"enter integer "<<i<<endl;
int x;
cin>>x;
arr.push_back(x);
i++;
}
i=arr.size()-1;
while(i>=0)
{
cout<<arr[i]<<endl;
i--;
}
return 0;
}
part b:
code:
#include<iostream>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
int main()
{
int n;
char c;
do
{
cout<<"enter your string"<<endl;
char str[80];
cin.getline(str,80);
int i=0;
int cnt=0;
while(str[i]!='')
{
if(str[i]== ' ')
cnt++;
i++;
}
cout<<"number of words are : "<<cnt+1<<endl;
cout<<"REPEAT(Y/N)";
cin>>c;
}while(c!='N');
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.