Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void help()
- {
- cout << "Help: Follow the instructions to get the love quotient*** of two people! Start by inputing the names! \nSmall text:\n*The product doesn't perform actual magic.\n**All of this is bullshit. It doesn't actually have anything to do with love.\n***The love quotient doesn't actually show love\n****That might not necessarily be true." << endl;
- }
- int quo(string name)
- {
- int len = name.length();
- int midnum = len / 2;
- char first = name[0];
- char last = name[len];
- char mid = name[midnum];
- int firn = first;
- int midn = mid;
- int lasn = last;
- //cout << "DEBUG: " << midn << " " << firn << " " << lasn << " ";
- string type;
- if(len <= 5)
- {
- type = "short";
- } else if(5 < len < 10)
- {
- type = "medium";
- } else if(len >= 10)
- {
- type = "long";
- } else
- {
- return -1;
- }
- int sum = firn + lasn + midn - len;
- int after;
- if(type == "short")
- {
- after = sum * 23;
- }else if(type == "medium")
- {
- after = sum * 432; // some serious "A = 432 Hz" conspiracy here!
- }else if(type == "long")
- {
- after = sum * 666;
- }else
- {
- return -1;
- }
- int fin = after + len;
- int per = fin % 100;
- return per;
- }
- int process()
- {
- //intro
- string input;
- string name1;
- string name2;
- bool validN1 = false;
- bool validN2 = false;
- //get first name
- getline(cin, input);
- while(validN1 == false)
- {
- if(input == "/help")
- //Nice
- {
- help();
- cout << "Now input the first name!" << endl;
- getline(cin, input);
- validN1 = false;
- } else if (input.length() == 0)
- {
- cout << "You have to write something! Input the name:" << endl;
- validN1 = false;
- getline(cin, input);
- } else
- {
- name1 = input;
- cout << "Now enter the second name!" << endl;
- validN1 = true;
- }
- }
- //get second name
- getline(cin, input);
- while(validN2 == false)
- {
- if(input == "/help")
- {
- help();
- cout << "Now input the second name!" << endl;
- getline(cin, input);
- validN2 = false;
- } else if (input.length() == 0)
- {
- cout << "You have to write something! Input the name:" << endl;
- validN2 = false;
- getline(cin, input);
- } else
- {
- name2 = input;
- validN2 = true;
- }
- }
- //compute indexes
- int index1 = quo(name1);
- if(index1 < 0)
- {
- cout << "There was an error calculating the first person's quotient!";
- return 0;
- }
- int index2 = quo(name2);
- if(index2 < 0)
- {
- cout << "There was an error calculating the second person's quotient!";
- return 0;
- }
- if(name1 == name2)
- {
- index2 = (index2 * 443) % 100;
- }
- //finale computing
- int lqo = 100 - (abs(index1 - index2));
- if(lqo <= 10)
- {
- cout << "You're not likely to fall in love! Your score is ";
- } else if(lqo <= 25)
- {
- cout << "You have a small chance! Your score is ";
- } else if(lqo <= 50)
- {
- cout << "You have some chance! Your score is ";
- } else if(lqo <= 85)
- {
- cout << "You have a pretty good chance! Your score is ";
- } else if(lqo < 100)
- {
- cout << "You have a great chance! Your score is ";
- }else if(lqo == 100)
- {
- cout << "You're a perfect match! Your score is ";
- } else
- {
- cout << "There was an error calculating.";
- return 0;
- }
- cout << lqo << " points out of 100!" << endl;
- return 0;
- }
- int main()
- {
- cout << "Welcome to Definitely Not Mymokol's Magic* Machine™! This machine allows you to input two names, do all sorts of magical somethings and it will output how much love is between you two**! Start by typing in the names or type \"/help\" if you for whatever reason think you should." << endl;
- bool doProc = true;
- bool procDone = false;
- while(procDone == false)
- {
- process();
- procDone = true;
- cout << "Would you like to try again? Answer yes or no:" << endl;
- string ans;
- bool asked = false;
- while(asked == false)
- {
- getline(cin, ans);
- if(ans == "yes" || ans == "Yes" || ans == "YES")
- {
- doProc = true;
- asked = true;
- cout << "Type in the first name:" << endl;
- } else if(ans == "no" || ans == "No" || ans == "NO")
- {
- doProc = false;
- cout << "Closing the application!";
- return 0;
- } else if(ans == "/help")
- {
- help();
- asked = false;
- cout << "Now answer yes or no:" << endl;
- } else
- {
- cout << "You have to answer yes or no!" << endl;
- asked = false;
- }
- }
- asked = false;
- }
- while(doProc == true && procDone == true)
- {
- process();
- cout << "Would you like to try again? Answer yes or no:" << endl;
- string ans;
- bool asked = false;
- while(asked == false)
- {
- getline(cin, ans);
- if(ans == "yes" || ans == "Yes" || ans == "YES")
- {
- doProc = true;
- asked = true;
- cout << "Type in the first name:" << endl;
- } else if(ans == "no" || ans == "No" || ans == "NO")
- {
- doProc = false;
- cout << "Closing the application!";
- return 0;
- } else if(ans == "/help")
- {
- help();
- asked = false;
- cout << "Now answer yes or no:" << endl;
- } else
- {
- cout << "You have to answer yes or no!" << endl;
- asked = false;
- }
- }
- asked = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment