xxxxxxxxxx
from datetime import datetime
from your_app import db
class Manufacturer(db.Model):
__tablename__ = 'manufacturers'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
country = db.Column(db.String(100), nullable=False)
continent = db.Column(db.String(100), nullable=False)
established_year = db.Column(db.Integer, nullable=False)
created_at = db.Column(db.DateTime, default=datetime.utcnow)
updated_at = db.Column(db.DateTime, onupdate=datetime.utcnow)
def __repr__(self):
return f'<Manufacturer {self.name}>'
xxxxxxxxxx
/* These are preprocessor directives in C++. They might sound like quite a mouthful,
but they're simply instructions that tell the compiler to include libraries.
These libraries contain a set of pre-written functions and tools, making it easier
to perform various tasks without reinventing the wheel. */
// Library for standard input/output operations
#include <iostream>
// Library for general utilities
#include <cstdlib>
// It is preprocessor directives that allow access to these sets of functions
int main() {
std::cout << "Hello, World!\n"; // cout is imported from iostream
// Allocate memory for an array of 10 integers using new
int* var = new int[10]; // new is used in place of malloc in C++
// Check if memory allocation was successful
if (var == nullptr) {
std::cout << "Memory allocation failed!\n";
return 1; // Exit the program if memory allocation fails
}
// Assign values to the allocated memory
for (int i = 0; i < 10; i++) {
var[i] = i;
}
// Print values stored in allocated memory
for (int i = 0; i < 10; i++) {
std::cout << var[i] << " ";
}
std::cout << "\n"; // Newline for cleaner output
// Free the allocated memory to prevent memory leaks
delete[] var; // delete[] is used to free memory allocated with new
return 0; // Indicate successful program completion
}