How do I make a choice list?

Like... I understand Y/N questions but say.. I wanted to make a list of choices and a unique answer for each one...

Which website do you want to visit?

Youtube - Y
Facebook - F
Carl - C

with responses like the link to each one
I would use a switch case for that. Do you have any code so far?
Nope. Sadly I only studied this for a bit:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cctype>
#include <iostream>
#include <string>
using namespace std;

bool dogs_or_cats()  // true for dogs, false for cats
  {
  cout << "Do you prefer dogs or cats? ";
  while (true)
    {
    string s;
    cin >> ws;   // skip any leading whitespace
    getline( cin, s );
    if (s.empty()) continue;
    switch (toupper( s[ 0 ] ))
      {
      case 'D': return true;
      case 'C': return false;
      }
    cout << "Yes, but this is only about dogs or cats. Which do you prefer? ";
    }
  }

int main()
  {
  if (dogs_or_cats())
    cout << "You must be an energetic, fun-loving individual!\n";
  else
    cout << "You must be an empathetic, caring individual!\n";
  return 0;
  }

That pretty much does what you want. You'd just need to extend it a little bit to take those other letters.
Topic archived. No new replies allowed.