Hello I have question about some code. Is this code supose to work as it is here?
I thought I would need to use #include cstring
I asked my teacher and he told me that the code is good as it is and that it should work with #include string
Is this correct? can someone explain me please ?thank you.
#include <iostream>
#include <string> //strcpy() works with string?
using namespace std;
class libraryBook{
private:
char title [80]; //cstring
int available;
public:
libraryBook(char initTitle[]);//cstring as argument
};
libraryBook::libraryBook(char initTitle[]){
strcpy(title, initTitle);
available = 1;
}
int main() {
libraryBook b1 ("computing"); //what would be the output without changing the code ?
return 0 ;
}