nguyễn phát tài - ITPRO
unread,Aug 4, 2010, 1:41:05 PM8/4/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to OOP-He2010
tại sao đoạn code này lại báo lỗi.thầy và các bạn hãy kiểm tra giúp
mình thanks!!!!!!!!!
#include "iostream.h"
#include "stdlib.h"
#include "string"
using namespace std;
void sort(int n,string str[]);
void main ()
{
string str1("1234");
string str2("56789");
string s = str1 + str2;
cout<<"Result : "<< s <<endl;
string country[]={"viet nam","lao","campuchia","thai lan","trung
quoc"};
int n=5;
sort(n,country);
cout<<"after sorting : "<<endl;
for (int i=0;i<n;i++)
cout <<"\t"<< country[i] <<endl;
system("PAUSE");
}
void sort (int n,string str[])
{
for (int i=0;i<n-1;i++)
for (int j=0;j<n;j++)
if (str[i] >str[j])
{
string s=str[i];
str[i]=str[j];
str[j]=s;
}
}