I need to ask for input 6 integers 0-100, store them in an array, check if they are greater or smaller than 50 and then output how many are greater than 50 and how many are less than 50.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
int myarray[6]; // array declaration
int i; // loop variable
int cnt1; // counter of greater numbers
int cnt2; // counter of smaller numbers
i = 0;
while (i < 6) // loop for 6 valid inputs
cout << "Enter " << i + 1 << ". number 0-100: "; // prompt user for input (i + 1) because array is zero indexed
cin >> myarray[i]; // read input
if ((myarray[i] >= 0) && (myarray[i] <= 100)) // check if input within range, suppose no other chars than digits will be entered
i++; // move to next input
cout << "Input not in range 0-100. Repeat input" << endl; // repeat input message

By purchasing this solution you'll be able to access the following files:

50% discount

$15.00 $7.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats