How to compare strings in files

0

I would like to know how to compare strings in files to see if there is data that is being entered by keyboard.

Code

void agregar (){
            system ("cls");
    cout<<"ingrese el carnet del alumno"<<endl;
    cin>>carnet;
    cout<<"ingrese el nombre del alumno"<<endl;
    cin>>nombre;
    cout<<"ingrese el apellido del alumno"<<endl;
    cin>>apellidos;
    cout<<"ingrese el telefono del alumno"<<endl;
    cin>>telefono;
    cout<<"ingrese el correo del alumno"<<endl;
    cin>>correo;
    ofstream alum;
    alum.open("alumnos.txt",ios::app);
        alum<<carnet<<endl;
        alum<<nombre<<endl;
        alum<<apellidos<<endl;
        alum<<telefono<<endl;
        alum<<correo<<endl;
    //  char tem[10];
    //  char carnet[10];
    //if (strcmp(!tem,carnet)==0){
                //  cout<<"esta registrado"<<endl;
            //  }
            //  else{
            //      cout<<"ingrese otro numero de carnet"<<endl;
            //      cin>>alu.carnet;
            //      alum<<alu.carnet<<endl;

    //}
    alum.close();
    }
    
asked by Charly 10.04.2018 в 04:59
source

0 answers