Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**/
- /* FLAMES - Future Calculator */
- /* Perdicts your future co-ops (Lol! Seriously??) */
- /* Coded by: PIT_CSE_CodeMachines */
- /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**/
- #include <iostream>
- #include <string>
- #include <vector>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- //Global Results Storage
- string results[6]={"Friends","Loosers","Affectionate","Morons!!","Enemies","Siblings"};
- //Finds the number of unique charachters in the two names
- int findNumber(string str1,string str2)
- {
- int number=0,i,j;
- bool flag=false;
- for(j=0;j<str1.length();j++)
- {
- for(i=0;i<str2.length();i++)
- {
- if(str1[j]==str2[i])
- break;
- }
- if(i==str2.length())
- number++;
- }
- for(j=0;j<str2.length();j++)
- {
- for(i=0;i<str1.length();i++)
- {
- if(str2[j]==str1[i])
- break;
- }
- if(i==str1.length())
- number++;
- }
- return number;
- }
- //Evaluates the FLAMES algorithm
- string flames(int unique)
- {
- int n=6,x,y;
- string flamesString("Xflames");
- string::iterator itr=flamesString.begin();
- int i=unique;
- cout<<"\n-----------------------------------------------------------\nPlease wait while the computer ";
- cout<<"calculates your Future\n-----------------------------------------------------------";
- while(n!=1)
- {
- while(i>n)
- i-=n;
- time_t start_time, cur_time;
- itr+=(i);
- cout<<endl<<flamesString.substr(1,(flamesString.length()-1));
- flamesString.erase(itr);
- //cout<<endl<<flamesString.substr(1,(flamesString.length()-1));
- time(&start_time);
- do
- {
- time(&cur_time);
- }
- while((cur_time - start_time) < 1);
- // //Delay -------->Incase you have an "Extraordinary" processor , please increase the values below!!
- // for(x = 0; x < 1000; x++)
- // for(y = 0; y < 100000; y++);
- // //End Delay
- n--;
- i=i+unique-1;
- itr=flamesString.begin();
- }
- return flamesString;
- }
- //Function that is used to select appropriate result from Global Results Storage
- string resultsSender(char res)
- {
- switch(res)
- {
- case 'f':
- return results[0];
- case 'l':
- return results[1];
- case 'a':
- return results[2];
- case 'm':
- return results[3];
- case 'e':
- return results[4];
- case 's':
- return results[5];
- }
- }
- //The Main Function
- int main()
- {
- string nameOne,nameTwo,result;
- int uniqueChars;
- char choice;
- cout<<"-----------------------------------------------------------\n\t\tFLAMES";
- cout<<"- Future Calculator\n-----------------------------------------------------------\n";
- getnames:
- cout<<"\nEnter Name 1: ";
- cin>>nameOne;
- cout<<"\nEnter Name 2: ";
- cin>>nameTwo;
- //Are you serious?? :-O
- if(nameOne.compare(nameTwo)==0)
- {
- cout<<"\nPlease try with two different people! :-O \nTry again....";
- goto getnames;
- }
- //Call to function that returns number of unique chars
- uniqueChars =findNumber(nameOne,nameTwo);
- //Call to function that returns the remaining character in the FLAMES string
- result=flames(uniqueChars);
- //Call to function that returns the result string(your future!)
- result = resultsSender(result[1]);
- cout<<"\n-----------------------------------------------------------\nComputation Completed!\n-----------------------------------------------------------";
- cout<<"\n\nYou Both are "<<result;
- cout<<"\n\nTry Again?? <y/n>.....";
- cin>>choice;
- if(choice=='y'||choice=='Y')
- {
- goto getnames;
- system("cls");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment