#include #include /* * Question #1 * * Based on how you should name a variable, indicate whether each variable name * is conventional (follows best practices), unconventional (compiler will * accept but does not follow best practices), or invalid (will not compile), * and why. * */ int main() { // Assume it's obvious what we're summing // Conventional [[maybe_unused]] int sum {}; std::cout << "\"int sum {};\": conventional\n"; // Unconventional: starting with underscore [[maybe_unused]] int _apples {}; std::cout << "\"int _apples {};\": unconventional\n"; // Unconventional: starting with capital character and whole identifier // is uppercase [[maybe_unused]] int VALUE {}; std::cout << "\"int VALUE {};\": unconventional\n"; // invalid: whitespaces are not allowed //int my variable name {}; std::cout << "\"int my variable name {};\": invalid\n"; // Unconventional: starting with capital character [[maybe_unused]] int TotalCustomers {}; std::cout << "\"int TotalCustomers {};\": unconventional\n"; // invalid: reserved word used for identifier //int void {}; std::cout << "\"int void {};\": invalid\n"; // Conventional [[maybe_unused]] int numFruit {}; std::cout << "\"int numFruit {};\": conventional\n"; // invalid: starting with a number //int 3some {}; std::cout << "\"int 3some {};\": invalid\n"; // Conventional [[maybe_unused]] int meters_of_pipe {}; std::cout << "\"int meters_of_pipe {};\": conventional\n"; std::cout << "\nLook comments in source code for explanations." << std::endl; return 0; }