Trying to run this program, but whenever it runs is quickly opens up and closes right away without allowing me to interact with it. What am I doing wrong to make it open and close?
Below is my program, and I'm sure I'm doing something wrong.
Thanks for your help!
Driver.cpp
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
char Anagram();
}
Anagram.cpp
#include<string>
#include<algorithm>
#include<iostream>
#include "Anagram.h"
using namespace std;
char Anagram()
{
string FirstAnagram, SecondAnagram;
char keep_going;
do
{
cout << "Enter word one: ";
cin >> FirstAnagram;
cout << "Enter word two: ";
cin >> SecondAnagram;
sort(FirstAnagram.begin(), FirstAnagram.end());
sort(SecondAnagram.begin(), SecondAnagram.end());
if (FirstAnagram == SecondAnagram)
{
cout << "They are anagrams of each other.";
}
else
{
cout << "They are not anagrams of each other.";
}
cout << "\n\nTry another?";
cin >> keep_going;
}
while (keep_going == 'y');
return 0;
}
Anagram.h
char Anagram();