0% found this document useful (0 votes)
12 views

Object Oriented Programming

The document describes a C++ program that implements a phone directory using a struct to store records. The program allows the user to add, update, and delete records and displays the stored records.

Uploaded by

Eman Rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Object Oriented Programming

The document describes a C++ program that implements a phone directory using a struct to store records. The program allows the user to add, update, and delete records and displays the stored records.

Uploaded by

Eman Rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Object oriented programming

Assignment 1

Submitted to Resprcted ma’am : Nosheen Manzoor


{ University of Management nd Technology }

Submit by : Eman Ali ( F2022105118 )


#include <iostream>

#include <string>

using namespace std;

struct student

string name;

string fathername;

string roll_number;

string home_add;

};

student record_direc[10];

void adding_rec(int cen) {

cout<<"Enter Your Name : ";

cin>>record_direc[cen].name;

cout<<"Enter Your Father Name : ";

cin>>record_direc[cen].fathername;

cout<<"Enter Your Roll Number : ";

cin>>record_direc[cen].roll_number;

cout<<"Enter Your Home Address : ";

cin >>record_direc[cen].home_add;

void update_Record(int cen) {

cout<<"Enter Your New Name : ";

cin>>record_direc[cen].name;

cout<<"Enter Your New Father Name : ";

cin>>record_direc[cen].fathername;

cout<<"Enter Your New Roll Number : ";

cin>>record_direc[cen].roll_number;
cout<<"Enter Your New Home Address : ";

cin>>record_direc[cen].home_add;

void remove_Record(int cen) {

record_direc[cen] = {" ", " "," ", " "};

int main()

int choose,cen;

do{

cout<<"Phone Directory"<<endl;

cout<<"1-Adding Record"<<endl;

cout<<"2-Updating Record"<<endl;

cout<<"3-Deleting Record"<<endl;

cout<<"4-Quit"<<endl;

cout<<"Choose Number (1 to 4) : ";

cin >>choose;

switch (choose) {

case 1:

cout<<"Enter Number from 0 to 9 ";

cin>>cen;

adding_rec(cen);

break;

case 2:

cout<<"Enter Number from 0 to 9 ";

cin>>cen;;

update_Record(cen);

break;
case 3:

cout<<"Enter Number from 0 to 9 ";

cin>>cen;

remove_Record(cen);

break;

case 4:

cout<<"Exiting"<<endl;

break;

default:

cout<<"EMPTY"<<endl;

break;

}while(choose!=4);

cout<<"Record of Directory "<<endl;

for(int m=0;m<10;m++)

cout<<m<<endl;

cout<<"Your Name is : ";

cout<<record_direc[m].name<<endl;

cout<<"Your Father Name is : ";

cout<<record_direc[m].fathername<<endl;

cout<<"Your Roll Number is : ";

cout<<record_direc[m].roll_number<<endl;

cout<<"Your Home Address is : ";

cout<<record_direc[m].home_add<<endl;

You might also like