1 answer

Please solve it before 11:15 today Subject :C++ programming - Lab_9_Sec 51.pdf 1411113: Programming for Engineers...

Question:

- Lab_9_Sec 51.pdf 1411113: Programming for Engineers Fall 2017/2018 LAB #9 Name: ID: Date Section Objectives: After completing this lab, you will be able to .Analyze a problem. .Implement the solution in C++ . Practice arrays and strings. Lab Exc. Mark Score Correct input/output Computational correctness Correct input/output Computational correctness Exercise#1: Number of occurrences in an array Write a program that fills an array with 10 random numbers between 0 and 9 and prints the generated numbers, Then the program asks the user to enter a positive integer N <10 and finds the number of occurrences of N in the array Sample Input/Output: e enerted nles are inter an inteyer: 8 nter an intege 4 is not in thc array appe aF 2 tie in te array Exercise#2: Number of words in a string Write a program that counts the number of words in a string. Sample input /output: t nunbetiinber of word Quick Delivery & Best Prices Call now for a Quotation officeoneuae.com Paper in Dubai ⓘ Office One

please solve it before 11:15 today
Subject :C++ programming

- Lab_9_Sec 51.pdf 1411113: Programming for Engineers Fall 2017/2018 LAB #9 Name: ID: Date Section Objectives: After completing this lab, you will be able to .Analyze a problem. .Implement the solution in C++ . Practice arrays and strings. Lab Exc. Mark Score Correct input/output Computational correctness Correct input/output Computational correctness Exercise#1: Number of occurrences in an array Write a program that fills an array with 10 random numbers between 0 and 9 and prints the generated numbers, Then the program asks the user to enter a positive integer N <10 and finds the number of occurrences of N in the array Sample Input/Output: e enerted nles are inter an inteyer: 8 nter an intege 4 is not in thc array appe aF 2 tie in te array Exercise#2: Number of words in a string Write a program that counts the number of words in a string. Sample input /output: t nunbetiinber of word Quick Delivery & Best Prices Call now for a Quotation officeoneuae.com Paper in Dubai ⓘ Office One

Answers

#include<iostream>

#include <stdlib.h>

using namespace std;

int main()

{

int arr[10],count=0,n;

for(int i=0;i<10;i++)

{

arr[i]=(0+ rand() % 9+0) ;

}

cout<<"The Generated Numbers are : \n";

for(int i=0;i<10;i++)

{

cout<<arr[i]<<" ";

}

do{

cout<<"\nEnter an integer : ";

cin>>n;

}while(n<0 || n>10);

for(int i=0;i<10;i++)

{

if(arr[i]==n)

count++;

}

cout<<n<<" Appears "<<count<<" times in the array .";

}

İ CAUsersAppírio-7784\Documents random.exe The Generated Numbers are 5 84 8 1 3 2 nter an integer : 8 8 Appears 2 times in th2-

#include<iostream>

using namespace std;

int main( )

{

char arr[100];

cout << "Enter a string: ";

cin.getline(arr,100);

int count = 0;

for(int i = 0; arr[i] != '\0'; i++)

{

if (arr[i] == ' ') //Checking for spaces

{

count++;

}

}

cout << "The number of words = " << count+1 << endl;

return 0;

}

ClUsers Appirio 7784 Documentslrandom.exe Enter a string: Testing number of words he number of wo rds = 4 Process exited afte

.

Similar Solved Questions

1 answer
Case study 1 - Lets use this case study to try to troubleshoot the situation we...
Case study 1 - Lets use this case study to try to troubleshoot the situation we are all in together.   Considering the current Coronavirus crisis and the information you have learned so far in this class, what are some best practices you would suggest to family members, coworkers and frien...
1 answer
Look at the graph provided. What area on the graph represents consumer surplus?   a) A b)...
Look at the graph provided. What area on the graph represents consumer surplus?   a) A b) B c) B+A Price Supply curve Equilibrium 2 Demand curve Equilibrium quantity Quantity...
1 answer
Today, Company "A" purchases 100% of Company B Common Stock and assumes all of the outstanding...
Today, Company "A" purchases 100% of Company B Common Stock and assumes all of the outstanding Company B Liabilities. Immediately Before the acquisition, Company B had reported the following Balance Sheet Totals: Total Assets = $2,800 Total Liabilities = $2,100 Total Equity = $700 Immediatel...
1 answer
Can pipes that carry bitumen (oil) that undergo corrosion be extremely harmful to the environment? How...
Can pipes that carry bitumen (oil) that undergo corrosion be extremely harmful to the environment? How can we stop or decrease the corrosion of pipes?...
1 answer
6. [1/7 Points] DETAILS PREVIOUS ANSWERS SERPSE10 29.A.OP.028. MY NOTES ASK YOUR TEACHER PRACTICE ANOTHER Two...
6. [1/7 Points] DETAILS PREVIOUS ANSWERS SERPSE10 29.A.OP.028. MY NOTES ASK YOUR TEACHER PRACTICE ANOTHER Two coplanar and concentric circular loops of wire carry currents of 11 = 5.90 A and 12 = 2.40 A in opposite directions as in the figure below. Let r1 = 12.0 cm and r2 = 8.70 cm. (Assume the pos...
1 answer
I do not know what is diferrence between them plz give me help ASAP Question 12...
I do not know what is diferrence between them plz give me help ASAP Question 12 1 pts On the far right side of the AS curve, the economy is producing potential, and on the far left of the curve, it is producing .potential at; below below; above above; below Question 5 1 pts On the far left side o...
1 answer
What is the expected return and standard deviation of a portfolio consisting of $4200 invested in...
What is the expected return and standard deviation of a portfolio consisting of $4200 invested in a risk-free asset with an 6.9-percent rate of return, and $1400 invested in a risky security with a 18.9-percent rate of return and a 23.9-percent standard deviation?...
1 answer
A single phase motor draws a current of 30 A from a 240 V, 60 Hz....
A single phase motor draws a current of 30 A from a 240 V, 60 Hz. line. Refer to Problem Description 7.2. A capacitor with a reactance of 31 Ω is then connected in parallel with the motor. A Wattmeter connected to the circuit gives a reading of 5.4 kW. How much reactive power does the capacito...
1 answer
Please complete condensed balance sheet. The Cougar Hotel Condensed Balance Sheet December 31, 20X7 and 20x8...
please complete condensed balance sheet. The Cougar Hotel Condensed Balance Sheet December 31, 20X7 and 20x8 20x1 20x2 Changes Assets Current Assets Cash Accounts Receivable Inventory Prepaids Total Current Assets 305,124 522,417 199,000 52,000 1,078,541 159,000 456,377 247,000 49,000 911,377 0.85%...
1 answer
QUESTION 3 A mutual fund has 300 shares of General Electric, currenlty trading at $30, and...
QUESTION 3 A mutual fund has 300 shares of General Electric, currenlty trading at $30, and 400 shares of Microsoft, Inc. currently trading at $54. The fund has 1,000 shares outstanding. a) What is the NAV of the fund? b) If investors expect the price of General Electric to increase to $34 and the pr...
1 answer
Need help with b. i know that x=1 and x=-2. Just need a quick discussion on...
Need help with b. i know that x=1 and x=-2. Just need a quick discussion on the factorisation of the quadratic. Also, do both work in the original system? 3. Solve for r if possible: (a) ex - 4e2+ = 0 (b) In x + In (x + 1) = In 2...
1 answer
Question Set 2. For this question set, you will calculate labor productivity and multifactor productivity, both...
Question Set 2. For this question set, you will calculate labor productivity and multifactor productivity, both in tons of rice produced per dollar value of inputs. A Rice Manufacturer employs 65 field workers (each working 40 hours per week at a wage of $12hr) and 18 line workers (each working 40 h...
1 answer
A company invests RM 1,000,000 and completes an energy efficiency project at the beginning of year...
A company invests RM 1,000,000 and completes an energy efficiency project at the beginning of year 1. The firm is investing its own money and expects an internal rate of return, IRR, of at least 26% on constant positive annual net cash flow of RM200,000 over a period of 10 years, starting with year ...
1 answer
4) (5 points) What fraction of Vmax­ is observed at [S] = 5 KM? 5) (20...
4) (5 points) What fraction of Vmax­ is observed at [S] = 5 KM? 5) (20 points) For the following data: [S] (μM)         V0 (no inhibitor)                   V0 (2.45 &mu...
1 answer
The following information applies to the questions displayed below) Jacob is a member of WCC an...
The following information applies to the questions displayed below) Jacob is a member of WCC an LLC taxed as a partnership Jacob was alocated S0000 or bemess Income from WCC for the year Jacob's marginal income tax rates 37 percent. The business a location is subject to 29 percent of self employ...
1 answer
Dy If y(x) is the solution of dr 22 +1 and y(0) = 2 then y(3)...
dy If y(x) is the solution of dr 22 +1 and y(0) = 2 then y(3) = 33 OA +2 OB. +2V2 ос 0 OD +4 OE +4V2...
1 answer
If 153.48 mL of CO2 is collected at 14.0°C and 723 torr, what temperature (in °C)...
If 153.48 mL of CO2 is collected at 14.0°C and 723 torr, what temperature (in °C) will be required to produce 200.00 mL at.520 atm?...