first commit

This commit is contained in:
Jose Caban
2025-06-07 11:38:03 -04:00
commit e0316ca3ff
79 changed files with 3155 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.10)
# Modify only these if one source file!
project(CppFizzBuzz)
set(CURRENT_PROJECT_CODE_NAME fizzbuzz)
set(FILE_EXT cpp)
# End
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# We want all the warnings and as errors enabled
if (MSVC)
# warning level 4 and all warnings as errors
add_compile_options(/W4 /WX)
else()
# lots of warnings and all warnings as errors
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif()
add_executable(${CMAKE_PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/${CURRENT_PROJECT_CODE_NAME}.${FILE_EXT})
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
${EXTRA_INCLUDES}
)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC
${EXTRA_LIBS}
)

32
FizzBuzz/Cpp/fizzbuzz.cpp Normal file
View File

@@ -0,0 +1,32 @@
#include <iostream>
void fizzbuzz(int n)
{
for (auto i = 1; i <= n; i++)
{
if (i%3 == 0 || i%5 == 0)
{
if (i%3 == 0)
std::cout << "fizz";
if (i%5 == 0)
std::cout << "buzz";
}
else
{
std::cout << i;
}
std::cout << std::endl;
}
}
int main()
{
int n;
std::cout << "How many fizzbuzzes?: ";
std::cin >> n;
if (!std::cin.fail())
fizzbuzz(n);
else
printf("Invalid input\n");
return 0;
}