need assistance on my hw
this is what
Last edited on
do you have any questions?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#include <iostream>
#include <iomanip>
#define MAX 10
using namespace std;
void printArray(int a[], int count);
char printStar(){
return '*';
}
int main(){
int numbers[MAX];
int count = 0;
int input;
cout << "Enter up to 10 positive numbers, 0-70(Enter -1 to stop)" << endl;
do {
cout << "Enter a number: ";
cin >> input;
if ( input != -1 ) {
numbers[count++] = input;
if (input > 70 || input <= -2) {
cout << "You entered an incorrect number, (0-70) and only positives" << endl;
}
}
}while (input != -1 && count < MAX);
printArray(numbers, count);
return 0;
}
void printArray(int a[], int count) {
for (int i = 0; i < MAX; ++i) {
cout << "-------------------" << endl;
for (int j = 0; j < a[i]; ++j) {
cout << printStar();
}
cout << endl;
}
cout << "-------------------" << endl;
}
|
you can modify it yourself... (is this what you're lookin' for?)
Topic archived. No new replies allowed.