#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
string reversal(string normal);
int main()
{
char tryagain;
do
{
string words_normal;
cout << "Please Enter some words:" << endl;
getline(cin, words_normal);
cout << "Your words reversed are:\n" << reversal(words_normal) << "\n\n" << endl;
cout << "Would you like to try again? (Y/N)" << endl;
while (tryagain != 'y' ||tryagain != 'Y' ||tryagain != 'n' ||tryagain != 'N'
{
cin >> tryagain;
}
}
while (tryagain == 'y' || tryagain == 'Y';
return 0;
}
string reversal(string normal)
{
string reversed;
int a;
a = 0;
int i;
i = normal.length();
while (i>=0)
{
reversed[a] = normal[i];
a++;
i--;
}
return reversed;
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.