Problem:- Write A C++ Program To Read Infinite Number Then Arrange Ascending Order Using Pointer or write a c++ program to arrange the given numbers in ascending order using pointers or sort array of pointers c++ or program to sort an array in ascending order using pointers in c++ or sorting using pointers in c++ or bubble sort using pointers c++ or insertion sort using pointers c++ or array using pointers in c++ or c++ program to sort an array using pointers or c++ program to sort an array using pointers or write a c++ program to arrange the given numbers in ascending order using pointers or program to sort an array in ascending order using pointers in c++ or sorting using pointers c++ code or sort array of pointers c++ or sorting an array using pointers in c++
Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.
Logic:- We are using Malloc and realloc (reallocated memory during runtime ) after getting -1 stop inserting numbers and then use an any sorting algorithm and print the element of the array. if you don't know any sorting algorithm then you have to check here
1.C Program For Bubble Sort In Ascending And Descending Order
2.C Program For Selection Sort In Ascending And Descending order
3.C Program For Insertion Sort In Ascending Order
4.C Program For QUICK Sort In Ascending Order
5.C Program For MERGE Sort In Ascending Order
Extreme Recommended:- If this post is beneficial for you and you want Updates for New post then please like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.
Solution:-
Output:-
You May Also Like
1.C Program For Remove All Vowels From A String
2.C Program To Remove Given Word From A String
3.C Program To Convert String To Integer Without Using Library Functions
4.C Program For Upper Case And Lower Case Conversion And Vice-Versa
5.C Program For Reverse A String Using Library Function
6.C Program For HEAP Sort In Ascending Order Also Show Complexity
7. C Program To Insert An Element Desired or Specific Position In An Array
8. C Program For Remove Duplicates Items In An Array
9. C Program To Delete Element From Array At Desired Or Specific Position
10. C Program For Print "I AM IDIOT" Instead Of Your Name Using Array
11.C Program For Check String Is Palindrome Or Not Using For Loop
Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.
Logic:- We are using Malloc and realloc (reallocated memory during runtime ) after getting -1 stop inserting numbers and then use an any sorting algorithm and print the element of the array. if you don't know any sorting algorithm then you have to check here
Sorting
1.C Program For Bubble Sort In Ascending And Descending Order
2.C Program For Selection Sort In Ascending And Descending order
3.C Program For Insertion Sort In Ascending Order
4.C Program For QUICK Sort In Ascending Order
5.C Program For MERGE Sort In Ascending Order
Extreme Recommended:- If this post is beneficial for you and you want Updates for New post then please like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.
Solution:-
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
/*visit - programmingwithbasis.com*/
int *p,*q,i=1,j,k,temp;
cout<<"Enter Infinite Numbers and (-1 To Stop Reading)\n";
p=(int*)malloc(sizeof(int));
cin>>p[0];
while(p[i-1]!=-1)
{
i++;
p=(int*)realloc(p,sizeof(int)*i);
q=p;
cin>>p[i-1];
}
p=q;
for(j=1;j<i;++j)
{
for(k=0;k<i-j-1;++k)
{
if(p[k]>p[k+1])
{
temp=p[k];
p[k]=p[k+1];
p[k+1]=temp;
}
}
}
cout<<"\nAscending Order Is Given Below \n\n";
for(j=0;j<i-1;++j)
{
cout<<" "<<p[j];
}
}
Output:-
You May Also Like
1.C Program For Remove All Vowels From A String
2.C Program To Remove Given Word From A String
3.C Program To Convert String To Integer Without Using Library Functions
4.C Program For Upper Case And Lower Case Conversion And Vice-Versa
5.C Program For Reverse A String Using Library Function
6.C Program For HEAP Sort In Ascending Order Also Show Complexity
7. C Program To Insert An Element Desired or Specific Position In An Array
8. C Program For Remove Duplicates Items In An Array
9. C Program To Delete Element From Array At Desired Or Specific Position
10. C Program For Print "I AM IDIOT" Instead Of Your Name Using Array
11.C Program For Check String Is Palindrome Or Not Using For Loop
0 Comments: