writing code in enum
<p>I wrote a certain method on how to access my fields in a <code>class</code>, but my teacher told me I should use an <code>enum</code>.  </p>

<p>How can I re-write this code to use an <code>enum</code> and not use <code>goto</code>s?</p>

<pre><code>void SetType() {
    cout &lt;&lt; "Book SetType" &lt;&lt; endl;
    Choice: cout &lt;&lt; "Please Select from the list: \n "
            &lt;&lt; "1- Technical literature \n "
            &lt;&lt; "2- Fiction literature \n "
            &lt;&lt; "3- Textbook" &lt;&lt; endl;
    int i;
    cin &gt;&gt; i;

    switch (i) {
    case 1:
        Type = "Technical literature";
        break;
    case 2:
        Type = "Fiction literature";
        break;
    case 3:
        Type = "Textbook";
        break;
    default:
        cout &lt;&lt; "Erorr you entered a wrong choice" &lt;&lt; endl;
        goto Choice;
    }
}
</code></pre>
