Green_Rose said:
C++ mian kuch "alphabets" ko "ascending order" main kaisay likhain gai.......
Well u need to provide more details and
be specific, anyways, to sort strings in order
assending or decending, you basically
have to compare data.
For example if u r using strings u
will need to compare em
and swap values:
Code:
IF (the value of item1 is greater than the value of item2)
THEN
swap the values of item1 and item2
END IF
IF (the value of item2 is greater than the value of item3)
THEN
swap the values of item2 and item3
END IF
I do have a simmilar program that i made in VB6,
If u wana have look i can upload dat for u,
Edit:
ok i had time so i made u a better example:
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string item1, item2;
string Solution;
cout << "Please Enter First Word:\t";
cin >> item1;
cout << "\nPlease Enter Second Word:\t";
cin >> item2;
if (item1 > item2) { Solution = item1; item1 = item2; item2 = Solution; }
cout << "Sorted in Accending Order:\n\n";
cout << item1 << "\t" << item2 << "\n\n";
system ("PAUSE");
return 0;
}
Basicaly it takes two inputs and compare em,
then print results to screen after testing condition.
its very simple and esy, hope u understand...
-Saif
Bookmarks