I need to make a program ..... that will have a subject to change / variable and sort it alphabetically.
Output:
Enter the number of words you wanted to put : 3
mouse
cat
dog
Sorted Alphabetically is :
cat
dog
mouse
Please help me in this problem.. as of now this is my code yet ... i need to make it a variable
#include "stdafx.h"
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
char n;
string input1;
string input2;
cout << "Enter a string1 :";
cin >> input1;
cout << "Enter a string2 :";
cin >> input2;
input1.swap(input2);
cout << "Arranged alphabet is :"<< input1<< endl<< input2 << endl;
system("pause>0");
cin.get();
return 0;
}
Last edited on