I'm having a problem with converting a string to a char. ; Also I keep getting errors in regards to storing info in a object that will be stored in a class data member. Can anyone help?
Code:#include "song.h" #include <cstring> using namespace std; //char size[50]; string Song::getTitle() { return title; } string Song::getArtname() { return artname; } string Song::getAlbum() { return album; } string Song::setTitle() { return title; } string Song::setArtname() { return artname; } string Song::setAlbum() { return album; } bool Song::operator == (Song track) { char* temp1 = &title; char* temp2 = &artname; char* temp3= &album; if(strcmp(title, track.title) == 0 && strcmp(artname, track.artname) == 0 && strcmp(album, track.album) == 0) return true; else return false; } // the end of the function bool Song::operator > (Song track) { char* temp4 = &title[0]; char* temp5 = &artname[0]; char* temp6 = &album[0]; if (strcmp(title, track.title) > 0 && strcmp(artname, track.artname) > 0 && strcmp(album, track.album) > 0) return true; else return false; }I keep getting errors that say : Could not convert setTitle to bool. ???Code:if( choice == Add) { cout<<"Enter the name of your song: "<<endl; cin>>track[count].setTitle(); cout<<"Enter the Artist's name: "<<endl; cin>>track[count].setArtname(); cout<<"Enter the Album's name: "<<endl; cin>>track[count].setAlbum();



LinkBack URL
About LinkBacks


