diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml new file mode 100644 index 0000000..a75c487 --- /dev/null +++ b/.github/workflows/ci_cd.yml @@ -0,0 +1,27 @@ +name: C++ CI with Docker + +on: [push, pull_request] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Docker + run: | + sudo apt-get update + sudo apt-get install -y docker.io + + # Optional: If you want to clone the cpp-container repository inside your CI job + # or if your Dockerfile is in your HelloWorld repo, adjust accordingly + - name: Build Docker Image + run: | + docker build -t cpp-container . + + - name: Run Tests in Docker + run: | + docker run -v ${{ github.workspace }}:/usr/src -w /usr/src cpp-container sh ./test_runner.sh + diff --git a/main.cpp b/main.cpp index b22f491..c18653e 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,32 @@ #include +#include +#include + +int main() { + std::vector favoriteFoods; + std::string input; + + std::cout << "Enter your favorite food one by one. Type 'done' when finished.\n"; + + while (true) { + std::cout << "What's your favorite food? "; + std::getline(std::cin, input); + + // Check if the user is done entering foods + if (input == "done") { + break; + } + + // Add the food to the list + favoriteFoods.push_back(input); + } + + // Print the list of favorite foods + std::cout << "\nYour favorite foods are:\n"; + for (const auto& food : favoriteFoods) { + std::cout << "- " << food << "\n"; + } + + return 0; +} -int main(){ - std::cout<<"Hello World!\n"; - return 0; -} \ No newline at end of file