Question

Please complete in C++

(histogram.cpp) Write a pseudocode and C++ program that reads numbers from an array (use another function to initialize the a

0 0
Add a comment Improve this question Transcribed image text
Answer #1

******************************************************************************************
Please Upvote the answer as it matters to me a lot :)
*****************************************************************************************
As per HomeworkLib expert answering guidelines,Experts are supposed to answer only certain number of questions/sub-parts in a post.Please raise the remaining as a new question as per HomeworkLib guidelines.
******************************************************************************************

#include <bits/stdc++.h>
using namespace std;

int main() {
int a[10];
for(int i=0;i<10;i++)a[i]= rand()%20 + 1;
cout<<"Element"<<setw(7)<<"Value"<<setw(16)<<"Histogram\n";
for(int i=0;i<10;i++)
{
cout<<i<<setw(10)<<a[i]<<setw(10);
for(int j=0;j<a[i];j++)cout<<"*";cout<<endl;
}
   return 0;
}

C++14 Shortcuts S Reset Copy 1 #include <bits/stdc++.h> 2 using namespace std; +14 4- int main() { int a[10]; for(int i=0; i<

Add a comment
Know the answer?
Add Answer to:
Please complete in C++ (histogram.cpp) Write a pseudocode and C++ program that reads numbers from an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that first reads an integer for the array size, then reads numbers into...

    Write a program that first reads an integer for the array size, then reads numbers into the array, computes their average, and finds out how many numbers are above the average. Make sure to include pointer syntax. Example output: Enter array size: 10 10 random numbers between 1 and 10 generated are: 2 8 5 1 10 5 9 9 3 5 The average is: 5.7 Number of items above the average = 4 C++ Code only.

  • java for netbeans Question 2: (Print distinct numbers) Write a program that reads in ten numbers...

    java for netbeans Question 2: (Print distinct numbers) Write a program that reads in ten numbers and displays the number of distinct numbers and the distinct numbers separated by exactly one space (i.e., if a number appears multiple times, it is displayed only once). (Hint: Read a number and store it to an array if it is new. If the number is already in the array, ignore it. After the input, the array contains the distinct numbers. Here is the...

  • write in c programming Write a C program that reads in up to 10 numbers into...

    write in c programming Write a C program that reads in up to 10 numbers into an array. The program should count the number of duplicate elements within that array and print the result. Example test data and expected output is given below Test Data: [2,1,1,2,1,3, 4] Duplicates:

  • Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive...

    Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive integer numbers from 1 to 999 (lottery numbers) and takes a single input from the user and checks the input against the 15 lottery numbers. The user wins if her/his input matches one of the lottery numbers. Your implementation must have a level of modularity (using functions) Functions you need to implement: Define function initialize() that takes array lotterNumbers[] as a parameter and assigns...

  • 2. Write a program that reads N integer numbers of array from the user and then...

    2. Write a program that reads N integer numbers of array from the user and then displays the sum, max number and the numbers of the array use four subroutines ( Read_Array(), Calculate_Sum(), Find_Max() and Display_Array()). Here is sample output Please enter number of elements: 4 Please enter the required numbers: 50 100 150 20 The entered numbers are: 50 100 150 20 Sum is : 320 Max is 150 by Mpsi ,sum and max to call subroutine and retrieve...

  • Please do in C and only use stdio.h. Write a program that reads n integers into...

    Please do in C and only use stdio.h. Write a program that reads n integers into an array, then prints on a separate line the value of each distinct element along with the number of times it occurs. The values should be printed in ascending order. Turn in your code and input/result together. Suppose, for example, that you input the values -7 3 3 -7 5 5 3 as the elements of your array. Then your program should print -7...

  • C++ PROGRAMING Write a program that reads numbers from the input stream until a zero is...

    C++ PROGRAMING Write a program that reads numbers from the input stream until a zero is encountered. Display the average (rounded down to an integer), the maximum number and the minimum number. Assume that numbers entered will be between 1 and 1000. For example: Enter a number: 33 Enter a number: 88 Enter a number: 77 Enter a number: 22 Enter a number: 66 Enter a number: 55 Enter a number: 0 Average: 56 Max: 88 Min: 22 Another example:...

  • Can you please answer this in complete C++ program. I. Write a program that reads in...

    Can you please answer this in complete C++ program. I. Write a program that reads in an array of five integers al 5] and arses the mray in t fncion largest that rcurns the value of the largest element in the arrav, 2.Write a program that reads in two arrays, a[3] and b[3], and passes them to a function Scalarproduct that returns the scalar product of these arrays; the scalar product of two arrays is

  • (a) Write a C program to print a list of all integers between 1 and 1,000...

    (a) Write a C program to print a list of all integers between 1 and 1,000 (inclusive) which are divisible by 7 but not by 13. The list should be printed to a file called "output.dat". Remember to close the file after use. (35%) (b) Explain what is meant by the C preprocessor. Explain the effect of the following line of code: #define SQUARE (x) (x) * (x) (25%) (c) Explain the concept of an array in C. Write down...

  • 1. Write a program that reads a sequence of numbers from the keyboard, and displays the...

    1. Write a program that reads a sequence of numbers from the keyboard, and displays the smallest number. The sequence has at least one number and is terminated by -999(-999 will not appear in the sequence other than as the end marker). 2. Write a program which requests an integer input n from the keyboard and computes the sum of square of k for all k from 1 to n(inclusive). use java

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT