Skip to content

This repository contains a collection of C++ and CUDA programming experiments, learning projects, and problem-solving exercises.

Notifications You must be signed in to change notification settings

jpruiz114/cpp-tests

Repository files navigation

C++ Learning and Testing Repository

This repository contains a collection of C++ and CUDA programming experiments, learning projects, and problem-solving exercises.

Project Structure

Basic C++ Programs

  • HelloWorld.cpp - Simple "Hello World" program demonstrating basic C++ output
  • DevCppTest01/ - Another basic "Hello World" C++ program for testing Dev-C++ environment

CUDA Learning Projects

Three progressive CUDA examples demonstrating GPU programming concepts:

  • CUDA_Test01/ - Basic CUDA "Hello World" with empty GPU kernel
  • CUDA_Test02/ - Simple integer addition on GPU, demonstrates:
    • Memory allocation on GPU
    • Host-to-device data transfer
    • Kernel execution
    • Device-to-host data transfer
  • CUDA_Test03/ - Vector addition template (incomplete implementation)

Mathematical Problem Solver

DevCppTest02/ - Comprehensive solution to a Vietnamese elementary school math puzzle that went viral in 2015:

The Puzzle

Fill in the blanks with digits 1-9 (each used exactly once):

_ + 13 × _ ÷ _ + _ + 12 × _ - _ - 11 + _ × _ ÷ _ - 10 = 66

Solution Components

  • main.cpp - C++ brute force solver that generates combinations with unique digits
  • pythonTest1.py - Python solution using itertools permutations (more elegant approach)
  • Solutions.txt - Complete list of 136 valid solutions
  • 1.txt through 9.txt - Generated digit combination files
  • Link.txt - References to original news articles about the puzzle
  • Math problem doc/ - Documentation and images related to the puzzle

References

The puzzle gained international attention when it appeared in a Vietnamese 3rd-grade math workbook:

Building and Running

C++ Programs

g++ HelloWorld.cpp -o HelloWorld
./HelloWorld

CUDA Programs

Requires NVIDIA CUDA Toolkit:

nvcc kernel.cu -o cuda_program
./cuda_program

Math Puzzle Solver

# C++ version
g++ DevCppTest02/main.cpp -o puzzle_solver
./puzzle_solver

# Python version
python DevCppTest02/pythonTest1.py

Learning Objectives

This repository demonstrates:

  • Basic C++ programming concepts
  • CUDA GPU programming fundamentals
  • Algorithmic problem solving
  • Combinatorial mathematics
  • Cross-language problem solving (C++ vs Python approaches)

About

This repository contains a collection of C++ and CUDA programming experiments, learning projects, and problem-solving exercises.

Resources

Stars

Watchers

Forks