#include<iostream>
#include<conio.h>
#include<fstream>
using namespace std;
int main()
{
char name[100];
int roll;
cout << "Enter name: ";
cin>> name;
cout << "Enter Roll: ";
cin>> roll;
ofstream file;
file.open("file.txt",ios::app);
if(file.is_open())
{
file<< name<< roll<< endl;
}
file.close();
ofstream file2;
char n[100];
file2.open("file.txt",ios::in);
cout << "Enter name : ";
cin >> n;
if(strcmp(n,name)==0)
{
cout << name <<":" << roll;
}
file2.close();
getch();
return 0;
}
#include<conio.h>
#include<fstream>
using namespace std;
int main()
{
char name[100];
int roll;
cout << "Enter name: ";
cin>> name;
cout << "Enter Roll: ";
cin>> roll;
ofstream file;
file.open("file.txt",ios::app);
if(file.is_open())
{
file<< name<< roll<< endl;
}
file.close();
ofstream file2;
char n[100];
file2.open("file.txt",ios::in);
cout << "Enter name : ";
cin >> n;
if(strcmp(n,name)==0)
{
cout << name <<":" << roll;
}
file2.close();
getch();
return 0;
}