| | |
help with this prog
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2004
Posts: 13
Reputation:
Solved Threads: 0
program that asks user to input 12 numbers of any type
or domain (i.e. positive or negative) and record user's responce into an
array.
Process the input by manipulating it so that the numbers are arranged in
the array in an ascending order (e.g. -1.2, -1, 0, 3, 4, 4.05, 4.1, 5).
After the manipulation is complete, print the resulting values in the
array in one line. i wrote it this much so far
#include <iostream>
using namespace std;
int main ()
{
float x;
int i;
for ( i = 0; i < 12; ++i )
{
cout << "Enter values #" << i + 1 << ": ";
cin >> x;
}
}
but i need help with array part and printing part..
or domain (i.e. positive or negative) and record user's responce into an
array.
Process the input by manipulating it so that the numbers are arranged in
the array in an ascending order (e.g. -1.2, -1, 0, 3, 4, 4.05, 4.1, 5).
After the manipulation is complete, print the resulting values in the
array in one line. i wrote it this much so far
#include <iostream>
using namespace std;
int main ()
{
float x;
int i;
for ( i = 0; i < 12; ++i )
{
cout << "Enter values #" << i + 1 << ": ";
cin >> x;
}
}
but i need help with array part and printing part..
C++ Syntax (Toggle Plain Text)
#include <algorithm> #include <iostream> using namespace std; int main() { double list[12]; cout<<"Enter 12 numbers: "; for ( int i = 0; i < 12; i++ ) cin>> list[i]; sort ( list, list + 12 ); for ( int i = 0; i < 12; i++ ) cout<< list[i] << ( i + 1 == 12 ? "" : ", " ); cout<<endl; }
I'm here to prove you wrong.
![]() |
Similar Threads
- Prog and Logic Question for beginner (Legacy and Other Languages)
- help me in my password checking prog (C++)
- plz debug my prog to insert value in an array (C++)
- how to run simple c++ prog from another system? (C++)
- help with this prog (C++)
- Prog to list ASCII codes (beginners' stuff) (C)
Other Threads in the C++ Forum
- Previous Thread: help me find the error
- Next Thread: Help Reading Info in Text File Into an Array
| Thread Tools | Search this Thread |
api array beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion count database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive return sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






