[ create a new paste ] login | about

Link: http://codepad.org/TjYMhYw2    [ raw code | output | fork ]

C++, pasted on May 19:
#include <iostream>
#include <string>
#include <sstream>
#include <regex>
#include <conio.h>
#include <stdlib.h>

using namespace std;

int main()
{

string a;
bool SaiPrograma = false;
   while (!SaiPrograma){
    cout<<"Digite a String"<<endl;
    cin>> a;

    regex CEP ("[0-9]{8}");
    bool achou1 = regex_match(a, CEP);
    
    regex CPF ("[0-9]{11}");
    bool achou2 = regex_match(a, CPF);
    
    regex Placa ("[a-z]{3}[0-9]{4}");
    bool achou3 = regex_match(a, Placa);
    
    regex Float ("[0-9]*[.|,][0-9]*");
    bool achou4 = regex_match(a, Float);
    
    regex Data ("[0-9]{2}[/][0-9]{2}[/][0-9]{4}");
    bool achou5 = regex_match(a, Data);

     if (achou1 == true){
        system("cls");
        cout<<"CEP identificado"<<endl;
      }
      if (achou2 == true){
        system("cls");
        cout<<"CPF identificado"<<endl;
      }
      if (achou3 == true){
         system("cls");
        cout<<"Placa identificada"<<endl;
      }
      if (achou4 == true){
          system("cls");
          cout<<"Float identificado"<<endl;
      }
      if (achou5 == true){
          system("cls");
          cout<<"Data identificada"<<endl;
      }
   }

return 0;
}


Output:
1
2
3
4
5
Line 16: error: regex: No such file or directory
Line 18: error: conio.h: No such file or directory
In function 'int main()':
Line 19: error: 'regex' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: