Database searching function

Hello everybody,

The title says it all, I made a simple database that saves the data in a text file. but I need to add a search function, also, I want to know how to set the search function. what I mean by setting, I mean the search type like due to (name, ID's or classes and etc..) I really need some easy examples because I'm still a beginner. thanks!


Codes:

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstdlib>


using namespace std;

int main()
{
int repeat;
int m;
string d1,d2,d3;
ofstream test;
test.open ("Data.txt", ios::out | ios::ate | ios::app);
repeat: cout << "Student name: ";
m: cin >> d1;
test << d1 << endl;
cout << "" << endl << "";
cout << "Student ID: ";
cin >> d2;
test << d2 << endl;
cout << "" << endl << "";
cout << "Student class: ";
cin >> d3;
test << d3 << endl;
cout << "" << endl << "";
system("cls");
goto repeat;
goto m;
return 0;
}

Last edited on
Any help, please? :D
I recommend learning about basic program control flow and design first.
Topic archived. No new replies allowed.