Advertisement
kaikengtheng

validation check with string LOL

Jul 4th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. #include<string.h>
  2. #include<cstring>
  3. #include<stdint.h>
  4. #include<stdio.h>
  5. #include<stdlib.h>
  6. #include<iostream>
  7. using namespace std;
  8.  
  9.  
  10. int main()
  11. {
  12.     char confirmation[30],confession[30];
  13.     int repeat,repeat2;
  14.  
  15.         do
  16.         {
  17.             do
  18.             {
  19.                 cout<<"I love u, do u love me?\n\n";
  20.                 cin>>confession;
  21.                 if(strcmp(confession,"YES")==0||strcmp(confession,"yes")==0||strcmp(confession,"Yes")==0||strcmp(confession,"y")==0)
  22.                 {
  23.                     cout<<"aww, thanks for loving me~~~\n\n\n";
  24.                     repeat2=0;
  25.                 }
  26.                 else
  27.                     if(strcmp(confession,"NO")==0||strcmp(confession,"no")==0||strcmp(confession,"No")==0||strcmp(confession,"n")==0)
  28.                     {
  29.                         cout<<"How could u say u dont love me???\n\n\n";
  30.                         repeat2=0;                 
  31.                     }
  32.                     else
  33.                     {
  34.                         cout<<"\n\n\nInvalid input. Please key in correctly\n\n\n";
  35.                         system("pause");
  36.                         system("cls");
  37.                         repeat2=1;
  38.                     }
  39.                     system("pause");
  40.                     system("cls");
  41.             }while(repeat2>=1);
  42.         cout<<".....do u wish to continue?? yes? no?";
  43.         cin>>confirmation;
  44.  
  45.         if(strcmp(confirmation,"YES")==0||strcmp(confirmation,"yes")==0||strcmp(confirmation,"Yes")==0||strcmp(confirmation,"y")==0)
  46.         {
  47.             cout<<"sure\n\n";
  48.             system("pause");
  49.             repeat=1;
  50.             system("cls");
  51.         }
  52.         else
  53.             if(strcmp(confirmation,"NO")==0||strcmp(confirmation,"no")==0||strcmp(confirmation,"No")==0||strcmp(confirmation,"n")==0)
  54.             {
  55.                 cout<<"fine.....\n";
  56.                 system("pause");
  57.                 cout<<"See u again\n\n";
  58.                 system("pause");
  59.                 system("cls");
  60.                 repeat=0;
  61.                 cout<<repeat;
  62.                 system("pause");
  63.             }
  64.             else
  65.             {
  66.                 cout<<"Invalid input. Please key in correctly\n\n";
  67.                 repeat=1;
  68.                 system("cls");
  69.            
  70.             }
  71.         }while(repeat>=1);
  72.  
  73. return 0;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement