Defining our own data structures
Class definition must have ; at the end.
Preprocessor
The most common technique for making it safe to include a header multiple times relies on the preprocessor.
#include
Header guards
#ifndef SALES_DATA_H
#define SALES_DATA_H
#include
struct Sales_data {
std::string bookNo;
unsigned units_sold = 0;
double revenue = 0.0;
};
#endif
SALES_DATA_H can be any name, just it has to be unique throughout the program. preprocessor variables usually are written in all uppercase.
Comments
Post a Comment