1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
//User asked if they want to convert word. y or Y, anything else
//to stop. While convertingWords is y or Y, execute the program.
string convertingWords;
cout << "If you want to convert a word, type y or Y. If not, type any other key." << endl;
cin >> convertingWords;
string sloganWord;
while(convertingWords == "y" or convertingWords == "Y")
{
cout << "Type your word/slogan to have it converted." << endl;
cin.ignore(' ','\n');
getline(cin,sloganWord);
string newSloganWord;
//Use for loop, loop length of sloganWord's string size, evaluate 53 possible characters, if letters uppercase or lowercase, convert respectively, spaces skipped
//Increase string length every time a letter is found, only record 7 string characters.
cout << newSloganWord << endl;
//Convert sloganWord to a phone number, which only has seven total numbers, and has a hyphen after the third number.
//Ignore spaces, make upper and lowercase numbers synonymous, and ignore everything after the seventh LETTER.
cout << "Do you want to convert another word? Type y or Y to contiue, or any other key to stop. " << endl;
cin >> convertingWords;
}
}
|