-
Notifications
You must be signed in to change notification settings - Fork 0
/
displaydemo2.cpp
44 lines (36 loc) · 918 Bytes
/
displaydemo2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
#include<stdlib.h>
#include<fstream>
#include<string.h>
#include<iostream>
using namespace std;
void showdetails()
{
int f;
std::string id,name,gender,age,type,s;
std::cout<<"Enter the user----";
std::getline(std::cin,s);
fstream fhandle;
fhandle.open("login.csv",ios::in);
while(!fhandle.eof())
{
std::getline(fhandle,name,',');
std::getline(fhandle,id,',');
std::getline(fhandle,type,',');
std::getline(fhandle,age,',');
std::getline(fhandle,gender,'\n');
if(s==name)
f=1;
else
continue;
}
fhandle.close();
if(f==1){
std::cout<<"Name : "<<name<<endl;
std::cout<<"Id : "<<id<<endl;
std::cout<<"Gender : "<<gender<<endl;
std::cout<<"Age : "<<age<<endl;
std::cout<<"Type : "<<type<<endl;}
else{
cout<<"\n\n *********************** User does not exists***********************************\n\n\n";}
}