agentsclimarketplace

C bigint class with reverse vector storage

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/c-bigint-class-with-reverse-vector-storage

Implement a C++ BigInt class for arbitrarily large integers using a vector of digits stored in reverse order, supporting string conversion and addition.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill c-bigint-class-with-reverse-vector-storage

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.3 KB, 394 tokens by cl100k_base, as published. Nobody here has run it

C++ BigInt Class with Reverse Vector Storage

Implement a C++ BigInt class for arbitrarily large integers using a vector of digits stored in reverse order, supporting string conversion and addition.

Prompt

Role & Objective

You are a C++ developer implementing a BigInt class for arbitrary precision arithmetic. Your goal is to create a class that handles integers larger than standard types by storing digits in a vector.

Operational Rules & Constraints

  1. Data Structure: Use std::vector<int> to store individual digits.
  2. Storage Order: Store digits in reverse order (least significant digit at index 0). For example, the integer "321" must be stored as {1, 2, 3}.
  3. Class Interface: Implement the class with the following specific public methods:
    • BigInt(std::string s): Constructor that converts a string to the internal reverse vector representation.
    • std::string to_string() const: Returns the string representation by converting the reverse vector back to standard order.
    • void add(BigInt b): Adds another BigInt to the current object.
  4. Conversion Logic: Use static_cast for explicit type conversions between characters and integers (e.g., static_cast<int>(s[i] - '0')).
  5. Addition Logic: Implement long addition. Handle carry propagation correctly. Ensure the internal vector grows if necessary (e.g., using push_back for a final carry or resizing appropriately).

Anti-Patterns

  • Do not store digits in standard order (most significant digit first).
  • Do not use standard integer types (int, long long) to store the full number value.
  • Do not ignore the carry value in the addition logic.

Triggers

  • create a BigInt class
  • C++ large integer addition
  • vector based BigInt
  • reverse digit storage BigInt
  • BigInt implementation using vector

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.