| | |
Produce output
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
why the output do not produce the output after sorting....anybody knows how to do a selection sort code?
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <string> #include <cmath> #include <iomanip> #include <fstream> using namespace std; void selectionSort(int *y,int n)//selection sort function { int i, min,minat ; { for(i=0;i<3;i++) { minat=i; min=y[i]; if(min<y[i]) { minat=i; min=y[i]; } } int temp=y[i] ; y[i]=y[minat]; //swap y[minat]=temp; } } int main() { int x, y; ifstream inFile("jes.txt"); for (int i = 0; i < 3; i++) { if (inFile >> x >> y) { // Reading is successful if (inFile.fail()) { cout << "Error! Cannot open file! \n"; return -1; } cout <<" "<< x <<" "<<y<< endl; } // Print out sorted list. } cout<<"After Descending Order"<<"\n"; cout << x <<" "<< y <<" " ; cout << endl; return 0; }
![]() |
Similar Threads
- database problem (C#)
- C++ Fibonacci program help (C++)
- help in master slave output (C)
- Data loss in Type Conversion. (C++)
- Writing a loop statement that produces desired output (Java)
- print a number in ordered form (C++)
- I cant correct these two errors (C++)
- need help with arrays (C++)
- Producing Power set (C++)
- Newbie need help on HW (C++)
Other Threads in the C++ Forum
- Previous Thread: MapFileAndCheckSum returns CHECKSUM_MAPVIEW_FAILURE
- Next Thread: wrong output
Views: 343 | Replies: 0
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





