Dsa Project
Dsa Project
PROJECT
Topic-
Make following project in any language of your choice ,with following
functionalities in it
1. create a data structure (using Binary tree or linked list) and appropriate
storage of it for later access.
2. Student of all your class with Roll number , name, age, gender be entered (
once entered it must not erase even after power off, close, shut down)
3. You must be able to search data by roll number, by marks or by name.
Code:
#include <bits/stdc++.h>
using namespace std;
struct student
{
string name;
string roll_num;
string age;
string gender;
struct student *next;
};
void insert()
{
fstream sfile;
void search()
{
first = NULL;
last = NULL;
string student_name;
ifstream file("student_profile.txt");
string name;
string roll_num;
string age;
string gender;
while (file.good())
{
getline(file, name, ',');
getline(file, roll_num, ',');
getline(file, age, ',');
getline(file, gender, '\n');
if (first == NULL)
{
first = point;
last = point;
}
else
{
last->next = point;
last = point;
}
}
cout << endl;
cout<<”enter the name of the student you want to search: “;
do
{
if (temp->name == student_name)
{
cout << temp->name << temp->roll_num << temp->age <<
temp->gender << endl;
break;
}
temp = temp->next;
} while (!(temp->next == 0));
file.close();
}
int main()
{
fstream sfile;
return 0;
}
Output: