Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void help()
- {
- cout << "TEMPLATES: \n Icelandic = (+354) ### #### \n Czech = (+420) ### ### ### \nADD YOUR OWN TEMPLATE: Type /add" << endl << endl;
- }
- int main()
- {
- int oti1;
- string num;
- string mask;
- string prefix;
- string result;
- string chonput;
- string otu1;
- string otu2;
- string s1;
- string s2;
- string s3;
- string s4;
- string s5;
- int pos = 0;
- bool same = false;
- bool cont = true;
- bool repeat = true;
- cout << "Enter a phone number, and a formatting mask. Please don't use any special characters in the number. In the mask, substite numbers with hash signs (#). You can also choose from a few presets and save up to five of your own templates for transcribing bigger quantities of numbers. Note that saved templates will not be preserved after you close the application. To see the templates and how to save your own, type /help." << endl << endl;
- while(repeat == true)
- {
- if(same == false)
- {
- cout << "Pease enter the mask or choose your action." << endl;
- getline(cin, chonput);
- if(chonput == "/help")
- {
- help();
- cont = false;
- } else if(chonput == "/add")
- {
- cout << "Enter your custom mask:";
- getline(cin, otu2);
- cout << "What slot to save into? answer with an integer." << endl;
- cout << "s1: " << s1 << "\ns2: " << s2 << "\ns3: " << s3 << "\ns4: " << s4 << "\ns5: " << s5 << endl;
- cin >> oti1;
- switch(oti1)
- {
- case 1:
- s1 = oti1;
- break;
- case 2:
- s1 = oti1;
- break;
- case 3:
- s3 = oti1;
- break;
- case 4:
- s4 = oti1;
- break;
- case 5:
- s5 = oti1;
- break;
- default:
- cout << "Invalid input!" << endl;
- }
- oti1 = 0;
- otu2 = "";
- } else if(chonput == "Icelandic" || chonput == "icelandic" || chonput == "Iceland" || chonput == "iceland" || chonput == "Ísland" || chonput == "ísland" || chonput == "íslenskur" || chonput == "Íslenskur" || chonput == "is" || chonput == "IS")
- {
- mask = "### ####";
- } else if(chonput == "Czech" || chonput == "czech" || chonput =="Český" || chonput == "český" || chonput == "cz" || chonput == "CZ")
- {
- mask = "### ### ###";
- } else if(chonput == "/stop")
- {
- cout << "closing the application.";
- return 0;
- } else if(chonput == "s1")
- {
- mask = s1;
- }else if(chonput == "s2")
- {
- mask = s2;
- }else if(chonput == "s3")
- {
- mask = s3;
- }else if(chonput == "s4")
- {
- mask = s4;
- }else if(chonput == "s5")
- {
- mask = s5;
- } else
- {
- mask = chonput;
- }
- }
- cout << "Please now enter the number:" << endl;
- getline(cin, num);
- cout << endl << "Number:" << endl;
- for(int i = 0; i <= mask.length(); i++)
- {
- if(mask[i] == '#')
- {
- cout << num[pos];
- pos++;
- } else
- {
- cout << mask[i];
- }
- }
- cout << endl;
- if(pos < num.length())
- {
- cout << "Your number's length didn't match your mask, therefore it didn't get formatted properly." << endl;
- }
- pos = 0;
- cout << "Another number?" << endl;
- getline(cin, otu1);
- if(otu1 == "yes" || otu1 == "Yes" || otu1 == "1" || otu1 == "true")
- {
- cout << endl;
- } else
- {
- cout << "closing the application.";
- return 0;
- }
- otu1 = "";
- cout << "Same mask?" << endl;
- getline(cin, otu1);
- if(otu1 == "yes" || otu1 == "Yes" || otu1 == "1" || otu1 == "true")
- {
- cout << "ok";
- same = true;
- } else
- {
- cout << "ok";
- same = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment