Code:
#include iostream
#include iomanip
#include string
using namespace std;
int main()
{
int array[100001] = {0}, value;
char ch = 'y';
while (ch == 'Y' || ch == 'y')
{
cout<<"Enter an integer to be inserted: ";
cin>>value;
array[value] = value;
cout<<"Do you want to insert more ( Y or N): ";
cin>>ch;
}
for(int i = 0; i < 100001; i++)
{
if (array[i] != 0)
cout<
}
cout<
return 0;
}
Output:
Enter an integer to be inserted: 10
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 6
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 11
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 3
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 8
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 2
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 7
Do you want to insert more ( Y or N): Y
Enter an integer to be inserted: 1
Do you want to insert more ( Y or N): N
1 2 3 6 7 8 10 11
------------------
(program exited with code: 1)
Press return to continue
More C++ Programs: