el archivo se llama nombres.txt y contiene
Cita:
y el codigo es carlos, alberto, raul, tomas,
Código:
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
string linea;
string nombre;
char a=',';
cout<<"ingrese el nombre buscado"<<endl;
getline(cin, nombre);
ifstream miArchivo ("nombres.txt");
if (miArchivo.is_open())
{
while (getline(miArchivo, linea,a ))
{
if (nombre==linea)
{
cout<<"el nombre buscado esta presente "<<endl;
}
else
{
cout<<"el nombre no esta"<<endl;
}
}
miArchivo.close();
}
else
{
cout<<"algo paso"<<endl;
}
getchar();
return 0;
}





