


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



#include
char* singer_ptr() { char* siptr=Singer_Name;//pointer to singer return siptr; } char* mgenre_ptr()//pointer to genre { char* mptr=Music_Genre; return mptr; } char* record_ptr() { char* rcptr=Record_Name;//pointer to record return rcptr; } int* rdate_ptr() { int* rdptr=&(Release_Date.day);//pointer to date day return rdptr; } int* rmonth_ptr() { int* rmptr=&(Release_Date.month);//pointer to date month return rmptr; } int* ryear_ptr() { int* ryptr=&(Release_Date.year);//pointer to date year return ryptr; } int* song_ptr() { int* soptr=&songs;//pointer to no of songs return soptr;
void main() { int i,j,k,l=0; record music_col[100]; cout<<"how many records you want to enter ?"<<endl; cin>>k; if(k<0) cout<<"wrong input"<<endl; else { for(i=0;i<k;i++) { cout<<"enter singer name of "<< i+1 <<" record(at most 50 characters)"<<'\n'; cin.sync(); cin.getline(music_col[i].singer_ptr(), 50); cout<<"enter music genre of "<< i+1 <<" record(at most 50 characters)"<<'\n'; cin.getline(music_col[i].mgenre_ptr(), 50); cout<<"enter name of "<< i+1 <<" record(at most 50 characters)"<<'\n'; cin.getline(music_col[i].record_ptr(), 50); cout<<"enter release date of "<< i+1 <<" record"<<'\n'; cin>>(music_col[i].rdate_ptr()); cout<<"enter release month of "<< i+1 <<" record"<<'\n'; cin>>(music_col[i].rmonth_ptr()); cout<<"enter release year of "<< i+1 <<" record"<<'\n'; cin>>(music_col[i].ryear_ptr()); cout<<"enter no.of songs in "<< i+1 <<" record"<<'\n'; cin>>(music_col[i].song_ptr()); } while(l!=-1) { cout<<"what next you want to do ?"<<endl<<"1-to view any record"<<endl<<"2-to add record"<<endl<<"3-to delete record"<<endl<<"4-to exit the program"<<endl; cin>>j; switch(j) { case 1: if(k!=0) { cout<<"which record you want to see?"<<endl; cin>>i; if(i>0 && i<=k) { cout<<"Singer Name: "<<music_col[i- 1].singer_ptr()<<endl; //subsript of array starts from 0 cout<<"Music Genre: "<<music_col[i- 1].mgenre_ptr()<<endl;
break; default: cout<<"wrong input"<<endl; } } } }