Add .clang-format and apply it

This commit is contained in:
2021-12-02 07:18:16 +00:00
parent e58dede1b6
commit cd5e2538df
103 changed files with 2714 additions and 2132 deletions

View File

@@ -3,11 +3,13 @@
#include <iostream>
#include <string>
struct Box {
struct Box
{
/** Construct box.
* \param s String representation of dimensions 'lxwxh'
*/
Box(std::string const &s) {
Box(std::string const& s)
{
std::size_t pos = 0;
l_ = std::stoul(s, &pos, 10);
assert(s[pos] == 'x');
@@ -20,7 +22,8 @@ struct Box {
}
// How much paper does this box need?
unsigned long paper_needed() const {
unsigned long paper_needed() const
{
unsigned long s1 = l_ * w_;
unsigned long s2 = w_ * h_;
unsigned long s3 = h_ * l_;
@@ -28,7 +31,8 @@ struct Box {
}
// How much ribbon do we need?
unsigned long ribbon_needed() const {
unsigned long ribbon_needed() const
{
// The various side perimeters - we want the min of these multiplied by
// volume.
unsigned long p1 = 2 * (l_ + w_);
@@ -42,7 +46,8 @@ struct Box {
unsigned long h_;
};
int main(int argc, char **argv) {
int main(int argc, char** argv)
{
unsigned long total = 0;
for (std::string line; std::getline(std::cin, line);) {
Box b(line);