Created
May 11, 2018 16:46
-
-
Save edenizk/aa4c728fc3f915e65ba89ddae6f11d80 to your computer and use it in GitHub Desktop.
Palindrome Checker~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <windows.h> | |
| #include <time.h> | |
| #include <conio.h> | |
| using namespace std; | |
| /* run this program using the console pauser or add your own getch, system("pause") or input loop */ | |
| void progressbar(){ | |
| cout<<"\t\t\t\t "; | |
| /*Loading bar*/ | |
| for(int i=0; i<100/5; i++){ | |
| cout<<(char)177; | |
| } | |
| cout<<"<<\r\t\t\t\t"; | |
| for(int i = 0; i<=100; i++){ | |
| cout << "\r\t\t " << i << "% completed >>" ; | |
| for (int o=1;o<i/5;o++){ | |
| cout<<(char)219; | |
| } | |
| switch (i% 4) | |
| { | |
| case 0: cout<<"\r\t\t/"; break; | |
| case 1: cout<<"\r\t\t-"; break; | |
| case 2: cout<<"\r\t\t\\"; break; | |
| case 3: cout<<"\r\t\t-"; break; | |
| } | |
| Sleep(10); | |
| } | |
| cout<<endl; | |
| } | |
| int main(int argc, char** argv) { | |
| //int org=0,fake=0,eq=0; | |
| char again; | |
| int org=0,fake=0,eq=0; | |
| cout<<"\t~Welcome to Palindrome Checker~\n"; | |
| do | |
| { | |
| cout<<"\t-Please Enter a number : "; | |
| cin>>org; | |
| //tester | |
| if(cin.fail()||org<0) | |
| { | |
| cin.clear(); | |
| cin.ignore(10, '\n'); | |
| cout<<"\t -Its Not a number or Its a negative number\n\t -Please write it again :\n"; | |
| cin>>org; | |
| if(cin.fail()||org<0) | |
| { | |
| cout<<"\n\n\n\t -Please next time try to write a positive number..."; | |
| break; | |
| } | |
| } | |
| //tester | |
| fake=org; | |
| while (fake!=0) | |
| { | |
| eq=eq*10; | |
| eq=eq+fake%10; | |
| fake=fake/10; | |
| } | |
| progressbar(); | |
| if(org==eq) cout<<"\t ~"<<org<<" is a polindrome number.\n"; | |
| else cout<<"\t ~"<<org<<" is not a polidrome number.\n"; | |
| cout<<"\t\t-Do you wanna continue?[Y/N]\n"; | |
| again=getch(); | |
| system ("CLS"); | |
| eq=0; | |
| if((again=='n')||(again=='N')) cout<<"Good Bye..."; | |
| else if((again=='y')||(again=='Y')) cout<<"\t~Welcome Again to Palindrome Checker~\n"; | |
| else { | |
| cout<<"Please write [y/Y] for continue, and [n/N] for exit : "; | |
| cin>>again; | |
| system ("CLS"); | |
| if((again=='n')||(again=='N')) cout<<"Good Bye..."; | |
| else if((again=='y')||(again=='Y')) cout<<"\t~Welcome Again to Palindrome Checker~\n"; | |
| else | |
| { | |
| cout<<"You kicked :P"; | |
| break; | |
| } | |
| } | |
| }while((again=='y')||(again=='Y')); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment