Question: C++ Program Create a program that asks the user how many numbers they would like to sort and then allows them to enter in that
C++ Program
Create a program that asks the user how many numbers they would like to sort and then allows them to enter in that many numbers. You must store these numbers in a dynamic array.
Then have your program sort the numbers into 3 categories, whole, integers and rational. some numbers will be in multiple categories.
your programs output should look like the example below.
whole: 1,3,0,88
integers: -11,-17,1,3,0,88
rational: 55.45,6.8,-11,-17,1,3,0,88
I started the program, here's my code so far:
#include
int main() { int numberCount; cout << "How many numbers would you like to sort? "; cin >> numberCount; while (numberCount < 1) { cout << "Number must be greater than or equal to 1. "; cin >> numberCount; }
//doube arr[numberCounter]; double *arrPointer; arrPointer = new double[numberCount];
for (int i = 0; i < numberCount; i++) { cin >> arrPointer[i]; }
cout << "Whole: " << endl; cout << "Integers: " << endl; cout << "Rational: " << endl;
delete[] arrPointer;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
