write a c++ program to sort 10 floats in descending order using bubble sort method.......please DON'T GIVE ANY LINKS...
C++ program?
OK no problem bro...
CODE:
/////////////////////
#include "Iostream"
using namespace std;
int main()
{
float numbers[10] = {0,0,0,0,0,0,0,0,0,0};
//You may delete this code .... since I want the user to input
// some numbers...
for(int i = 0;i%26lt;10;i++){
cout%26lt;%26lt;"Enter the "%26lt;%26lt;i%26lt;%26lt;" number";
cin%26gt;%26gt;numbers[i];
}
////END OF USER INPUT
/////SORT THE ARRAY...
for(int i = 0;i%26lt;10;i++){
for(int j = i;j%26lt;10;j++){
if(numbers[j]%26gt;numbers[i])
numbers[i]=numbers[j];
}
}
//////////////END OF SORT/////////////////
////PRINT RESULTS...
for(int i = 0;i%26lt;10;i++){
cout%26lt;%26lt;numbers[i]%26lt;%26lt;"\n";
}
////////////////
///I divided the code in sections...using comments....
}
Reply:Can't you just do your homework by yourself
Ask for advices, not for the entire code, damn it!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment