0

Swapping numbers around

So I’m working on this code In c++ where the number can change is different line after you select them, for example let’s say you select a group of number any numbers right and the first line gives you 12 numbers and the second line gives you the same numbers but in different order and from min & max I know is weird but I’ having a hard time seen the big picture, Ohh and this is not an assignment it me seen If the number have the Same sequence of order

10th Aug 2019, 6:31 AM
KYLE XY
KYLE XY  - avatar
2 odpowiedzi
0
Please share your code link on question's Description, hopefully, with a code to review, it will become clearer what the problem is, and what will be the solution. In case you didn't know how to yet, you can see this how-to post on how to share links around SoloLearn. https://www.sololearn.com/post/74857/?ref=app
10th Aug 2019, 7:24 AM
Ipang
0
Here the code I have so far but, I'm having problem with the swapping and also trying to put it in order from min to max in every line any idea? #include <iostream> #include <time.h> using namespace std; void choose(int a,int b,int c,int d[]); void screen(int a[],int b); int main(){ int plays; int numbers; int price=plays*2; int playerNumbers[]={}; choose(numbers,plays,price,playerNumbers); screen(playerNumbers,plays); } void choose(int a,int b,int c,int d[]){ cout << "How many numbers? : "; cin >> a; cout << "How many plays? : "; cin >> b; cout << "That will cost " << c << endl; for(int i=1;i<=5;i++){ cout << "Number" << i << ":"; cin >> d[i]; } } void screen(int a[],int b){ for(int i=1;i<=5;i++){ cout << i; for(int j=0;j<5;j++){ cout << "[" << a[j+1] << "]"; } cout << endl; } }
13th Aug 2019, 8:50 PM
KYLE XY
KYLE XY  - avatar