Read numbers form user and place them in array, C/C++ Programming

Read numbers form user and place them in array:

Program is to read a group numbers of numbers form user and place them in array type of float and sort them

void sort(float a[]);

 int i,n;

 void main()

   {

    clrscr();

    float a[20];

    cout <<" enter  no of terms: ";

    cin>>n;

    cout<<" enter the elements ";

    for(i=0; i

     {

    cin>>a[i];

     }

    sort(a[i]);

   }

 

void sort(float a[])

  {

  int t,j,po;

  float min;

   for(i=0; i

    {

    min=a[i];

    po=i;

    for (j=i+1; j

     {

     if (a[j]

       {

      min=a[j];

      po=j;

       }

     }

  t=a[po];

  a[po]=a[i];

  a[i]=t;

  }

 for(i=0;i

 cout<<" sorted elements ";

 cout<

 }

Posted Date: 10/19/2012 5:44:21 AM | Location : United States







Related Discussions:- Read numbers form user and place them in array, Assignment Help, Ask Question on Read numbers form user and place them in array, Get Answer, Expert's Help, Read numbers form user and place them in array Discussions

Write discussion on Read numbers form user and place them in array
Your posts are moderated
Related Questions
Define Generic Bitwise Operations? Bitwise operators only work on an incomplete number of types int and char. It turns out there's above one kind of int. In particular there's

Is there any difficulty with the following : char*a=NULL; char& p = *a;? A: The result is indeterminate. You must never do this. A reference has to always refer to some object.

A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to execute an implied conversion of types. Its purpose is reserved ex

##question.A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string co   program in jav

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Define Bit Fields Bit Fields permits the packing of data in a structure. This is particularly useful when memory or data storage is at a premium. Usual examples: Packing

#include #include #include using namespace std; #define MAX 5 #define INF (1 #define DEBUG if(0) #define pii pair #define pb(x) push_back(x) class

#question.A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a s

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of p using a simulation method called "Monte Carlo". The following fi

how c program starts executing?