Skip to content

Commit

Permalink
Add C++ to fizzbuzz example
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-develop committed Jun 25, 2024
1 parent 12aeade commit 4bf4a87
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/fizzbuzz.c.py.noug → examples/fizzbuzz.cpp.c.py.noug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# /*
# This file can be executed both in Python, Nougaro and C, using NOUGAROIGNORE and docstrings.
# Change the extension of this file to allow GCC to recognise a C program
# This file can be executed in Nougaro, Python, C and C++, using NOUGAROIGNORE and docstrings.
# Change the extension of this file to allow GCC/G++ to recognise a C/C++ program
# This is a simple FizzBuzz program.
# */
#include <stdio.h>
Expand All @@ -9,12 +9,18 @@
## NOUGAROIGNORE
def fizzbuzz(n: int):
"""
Fizzbuzz algorithm that both work in Nougaro, Python and C
Fizzbuzz algorithm that work in Nougaro, Python, C and C++
!"""
"""
*/
# ifdef __cplusplus
#include <iostream>
void print(std::string x) {
std::cout << x << std::endl;
# else
void print(char *x) {
printf("%s\n", x);
# endif
}
/*
#! NOUGAROIGNORE
Expand Down

0 comments on commit 4bf4a87

Please sign in to comment.