Stephen Wilde
Welcome to my blog here you can find things I have made or I am working on. I program in C/C++, Python, JS, Lua and more.

Want Cake?

I continue my journey in learning C++. I have made a simple program that will ask you how much cake you want. You enter your numeric value and the output will say “You now have your-value pieces of cake”. It entertained my eldest child for a small amount of time. I would consider that a success. Below is the code.

#include <iostream>

using std::cout;
using std::cin;

int main() //main function

    //using namespace std;
    int sum;
    cout << "How many pieces of cake do you want? \n";
    cin >> sum;
    int mask = sum;
    //sum = 1000;
    cout << "You now have " << mask << " pieces of cake. " << std::endl;
    return 0;

You may also like...

1 Response

  1. April 13, 2020

    […] Want Cake? […]

Leave a Reply

Your email address will not be published. Required fields are marked *