#include <iostream>
#include <string.h>
using namespace std;
struct MyBook {
char title[64]; // Public by default
void show_book(void)
{
cout << "Book: " << title << " Price: $" << price ;
};
void set_price(float amount) { price = amount; };
void assign_title(char *name) { strcpy(title, name); };
private:
float price;
};
int main(void)
{
MyBook book;
book.assign_title("A");
book.set_price(49.95);
book.show_book();
}
|