Expanding on “Want Cake?” with Strings

So here is what I wanted for the want cake program I made. I really wanted it to output text as well. So I started working with strings to achieve this. Now the program asks “What drink do you want?”

#include <iostream>
#include <string>

using namespace std;

int main ()
{
  string cake;
  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, cake);
  cout << "You now have a " << cake << " aswell\n";
  return 0;
}
  

Original Want Cake program:

You may also like...

Leave a Reply

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