Joined
Last Seen
-2 Reputation Points
- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
0% Quality Score
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
0 Endorsements
Ranked #37.0K
2 Posted Topics
Re: Try this : [code] #include<iostream> #include<string> #include<fstream> using namespace std; int main() { int ndatamax=100; string line[ndatamax],linetemp; int i=0; int ndata; ifstream myfile; myfile.open("data.txt"); if(myfile.is_open()) { while(!myfile.eof()) { getline(myfile,line[i]); i++; } } ndata=i-1; // One way for sorting for(i=0;i<ndata;i++) { for(int j=i+1;j<ndata;j++) if( line[i]>line[j]) { linetemp=line[i]; line[i]=line[j];line[j]=linetemp;} } // new … |
The End.