write a program that prompts the user to input three number.the program should then output the numbers in ascending order.

simply 1st find the maximum number by comparing 2 numbers by 1st number. after finding order display them in loop.

simply 1st find the maximum number by comparing 2 numbers by 1st number. after finding order display them in loop.

#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;
int add(int ,int);
int main(int argc, char *argv[])
{
int array[3],temp,c=1;
for(int i=0;i<=3;i++)
{cin>>array[i];}
for(int j=0;j<=3;j++)
{
for(int i=c;i<=3;i++)
{if(array[j]>array[i])
{temp=array[j];
array[j]=array[i];
array[i]=temp;
}
}
c++;




}

for(int i=0;i<=3;i++)
cout<<array[i]<<endl;


system("PAUSE");
return EXIT_SUCCESS;
}
commented: Bad code, C++ instead of C, attempting to GIVE homework away. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.