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.

A touch more on the Want Cake? Program

So here is the end goal for this project and I know I am miles away from achieving it but its basically going to act as if its a shop. Already this concept is starting to take shape as you can see with the code below. What its lacking is overall functionality so I need to define what are acceptable choices and what are not so the end-user cant just type anything and it make no sense with the output. For example when it asks what cake do you want? You can pretty much enter anything and it will respond with your choice that’s a good choice! however, I need this program to only say that if it is actually a defined cake, if not it will say “Sorry we don’t have that” or something to that effect. The same goes for the drink option and now the program will restart from the beginning I will be adding a “Is that everything Yes/NO” then you can either choose Yes which will say thank you for shopping….. or no which will ask you what else you would like. This started off as a simple how many cakes do you want and I have now started to come up with an idea of what I actually want it to do.

#include <iostream>
#include <string>
#include <unistd.h>
#include <cstdlib>

using namespace std;

int main()

  string cake, drink;
  cout << "Hello and welcome to the cake shop - What type of cake do you want? ";
  getline (cin, cake);
  cout << cake << " Great Choice! \n";
  cout << "How many pieces of cake do you want? ";
  getline (cin, cake);
  cout << "You now have " << cake << " Pieces of Cake .\n";
  cout << "What drink do you want? ";
  getline (cin, drink);
  cout << "You now have a " << drink << " aswell\n";
  cout << "Thank you for shopping at The Cake Shop... Have a great day.... \n";
  cout << "Next customer please! \n";
  sleep (3); 
  //System Command that won't be staying I only added this until I learn  an alternative 
  goto cake;
          return 0;

You may also like...

Leave a Reply

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