commit 8bba9c559e3884778de63a013332006dd90d3609 Author: ShchegolikhYR Date: Fri Apr 11 11:31:00 2025 +0300 initial commit diff --git a/Gistogramma.xcodeproj/project.pbxproj b/Gistogramma.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2981d53 --- /dev/null +++ b/Gistogramma.xcodeproj/project.pbxproj @@ -0,0 +1,279 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 523FBF7E2DA909BA0044A741 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 523FBF7D2DA909BA0044A741 /* main.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 52E197542D5F35A1004F8E3E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 523FBF7D2DA909BA0044A741 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + 52E197562D5F35A1004F8E3E /* Gistogramma */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Gistogramma; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 52E197532D5F35A1004F8E3E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 52E1974D2D5F35A1004F8E3E = { + isa = PBXGroup; + children = ( + 523FBF7D2DA909BA0044A741 /* main.cpp */, + 52E197572D5F35A1004F8E3E /* Products */, + ); + sourceTree = ""; + }; + 52E197572D5F35A1004F8E3E /* Products */ = { + isa = PBXGroup; + children = ( + 52E197562D5F35A1004F8E3E /* Gistogramma */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 52E197552D5F35A1004F8E3E /* Gistogramma */ = { + isa = PBXNativeTarget; + buildConfigurationList = 52E1975D2D5F35A1004F8E3E /* Build configuration list for PBXNativeTarget "Gistogramma" */; + buildPhases = ( + 52E197522D5F35A1004F8E3E /* Sources */, + 52E197532D5F35A1004F8E3E /* Frameworks */, + 52E197542D5F35A1004F8E3E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Gistogramma; + packageProductDependencies = ( + ); + productName = Gistogramma; + productReference = 52E197562D5F35A1004F8E3E /* Gistogramma */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 52E1974E2D5F35A1004F8E3E /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1620; + TargetAttributes = { + 52E197552D5F35A1004F8E3E = { + CreatedOnToolsVersion = 16.2; + }; + }; + }; + buildConfigurationList = 52E197512D5F35A1004F8E3E /* Build configuration list for PBXProject "Gistogramma" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 52E1974D2D5F35A1004F8E3E; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 52E197572D5F35A1004F8E3E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 52E197552D5F35A1004F8E3E /* Gistogramma */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 52E197522D5F35A1004F8E3E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 523FBF7E2DA909BA0044A741 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 52E1975B2D5F35A1004F8E3E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 15.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 52E1975C2D5F35A1004F8E3E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 15.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + }; + name = Release; + }; + 52E1975E2D5F35A1004F8E3E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 52E1975F2D5F35A1004F8E3E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 52E197512D5F35A1004F8E3E /* Build configuration list for PBXProject "Gistogramma" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 52E1975B2D5F35A1004F8E3E /* Debug */, + 52E1975C2D5F35A1004F8E3E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 52E1975D2D5F35A1004F8E3E /* Build configuration list for PBXNativeTarget "Gistogramma" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 52E1975E2D5F35A1004F8E3E /* Debug */, + 52E1975F2D5F35A1004F8E3E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 52E1974E2D5F35A1004F8E3E /* Project object */; +} diff --git a/Gistogramma.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Gistogramma.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Gistogramma.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Gistogramma.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate b/Gistogramma.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..1521f01 Binary files /dev/null and b/Gistogramma.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Gistogramma.xcodeproj/xcuserdata/macbookpro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Gistogramma.xcodeproj/xcuserdata/macbookpro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..19c3f2d --- /dev/null +++ b/Gistogramma.xcodeproj/xcuserdata/macbookpro.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Gistogramma.xcodeproj/xcuserdata/macbookpro.xcuserdatad/xcschemes/xcschememanagement.plist b/Gistogramma.xcodeproj/xcuserdata/macbookpro.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..f0752e7 --- /dev/null +++ b/Gistogramma.xcodeproj/xcuserdata/macbookpro.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Gistogramma.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..ad05828 --- /dev/null +++ b/main.cpp @@ -0,0 +1,75 @@ +#include +#include +#include +using namespace std; + +int main () { + vector inscriptions; + vector numbers; + vector baskets; + size_t numbers_count; + size_t baskets_count; + size_t baskets_max_count; + const size_t screen_width = 80; + const size_t max_asterisk = screen_width - 3 - 1; + float basket_max; + float basket_min; + float basket_size; + cout.precision(4); + + cerr << "Введите кол-во чисел в строке: "; + cin >> numbers_count; + numbers.resize(numbers_count); + + cerr << "Введите строку чисел: "; + for (float& i : numbers) { + cin >> i; + } + + cerr << "Введите кол-во корзин: "; + cin >> baskets_count; + + baskets.resize(baskets_count); + inscriptions.resize(baskets_count); + + cerr << "Введите подписи к столбцам:" << endl; + for (string& i : inscriptions) { + cin >> i; + } + + basket_max = numbers[0]; + for (int i : numbers) { + if (i > basket_max) basket_max = i; + } + basket_min = numbers[0]; + for (int i : numbers) { + if (i < basket_min) basket_min = i; + } + + basket_size = (basket_max - basket_min) / baskets_count; + + for (int i = 0; i < baskets_count; i++) { + for (int j = 0; j < numbers_count; j++) { + if ((numbers[j] >= (basket_min + i * basket_size) and numbers[j] < (basket_min + (i + 1) * basket_size)) or (i == baskets_count - 1 and numbers[j] == basket_max)) { + baskets[i]++; + } + } + } + + baskets_max_count = baskets[0]; + for (size_t i : baskets) { + if (i > baskets_max_count) baskets_max_count = i; + } + + for (int i = 0; i < baskets_count; i++) { + size_t height = baskets[0]; + if (baskets_max_count > max_asterisk) { + height = max_asterisk * (static_cast(baskets[i]) / baskets_max_count); + } + cout << inscriptions[i] << "|"; + for (int j = 0; j < height; j++) cout << "*"; + cout << endl; + } + return 0; +} +