diff --git a/oef/programs/guess-output/function-blackjack.cpp b/oef/programs/guess-output/function-blackjack.cpp new file mode 100644 index 0000000000000000000000000000000000000000..052bd344f9f661a34433ab8353972ce7f348ecc8 --- /dev/null +++ b/oef/programs/guess-output/function-blackjack.cpp @@ -0,0 +1,42 @@ +#include <iostream> +using namespace std; + +int max(int x, int y) { + if(x > y) { + return x; + } + return y; +} + +int blackJack(int x, int y) { + if(x > 21) { + if(y > 21) { + return 0; + } + return y; + } + if (y > 21) { + return x; + } + return max(x,y); +} + + +int main() { + int x,y; + + x = 15; + y = 22; + cout << max(x,y) << endl; + cout << blackJack(x,y) << endl; + + x = 12; + y = 17; + cout << max(x,y) << endl; + cout << blackJack(x,y) << endl; + + x = 23; + y = 25; + cout << max(x,y) << endl; + cout << blackJack(x,y) << endl; +} diff --git a/oef/programs/guess-output/loop-indices-2.cpp b/oef/programs/guess-output/loop-indices-2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b4a69a9cbd1fd390f501a6b494bd0a6f13b0942f --- /dev/null +++ b/oef/programs/guess-output/loop-indices-2.cpp @@ -0,0 +1,12 @@ +#include <iostream> +using namespace std; + +int main() { + int i = 1; + + while(i < 11) { + cout << i << endl; + i = i * 2; + } + +} diff --git a/oef/programs/guess-output/loop-indices.cpp b/oef/programs/guess-output/loop-indices.cpp new file mode 100644 index 0000000000000000000000000000000000000000..71ace576611bcc50d5fea8c3aa795f3e369f5cb2 --- /dev/null +++ b/oef/programs/guess-output/loop-indices.cpp @@ -0,0 +1,12 @@ +#include <iostream> +using namespace std; + +int main() { + int i = 0; + + while(i < 11) { + cout << i << endl; + i = i + 2; + } + +} diff --git a/oef/programs/guess-output/loop-syracuse.cpp b/oef/programs/guess-output/loop-syracuse.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0f6e433ceae4c12154576ad54e4e05d298de0335 --- /dev/null +++ b/oef/programs/guess-output/loop-syracuse.cpp @@ -0,0 +1,14 @@ +#include <iostream> +using namespace std; + +int main() { + int i = 6; + while(i!=1) { + cout << i << endl; + if(i%2==1) { + i = 3*i + 1; + } else { + i = i/2; + } + } +}