If, else or switch based program (roman numbers) - help

I'm new to programming and I just need help because I'm stuck.
We need to make a program that will turn arab numbers from 1 to 50 to roman numbers, but when you write a number bigger than 50 it should say that the number is out of given borders.
I thought to use string and switch, but no matter how much I tried, I don't know what to do next.
I found a similar program that writes all the roman numbers and tried to use that code, but I cannot make it write just the numbers from 1 to 50.
Hope someone can help.
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  #include <iostream>
using namespace std;

string rim (int a, int b)
{
       string s = "";


       switch (a)
       {
              case 0: s = s + ""; break;
              case 1: s = s + "X"; break;
              case 2: s = s + "XX"; break;
              case 3: s = s + "XXX"; break;
              case 4: s = s + "XL"; break;
              case 5: s = s + "L"; break;
              default: cout << "The number is not in the given borders." << endl;
       }

       switch (b)
       {
              case 0: s = s + ""; break;
              case 1: s = s + "I"; break;
              case 2: s = s + "II"; break;
              case 3: s = s + "III"; break;
              case 4: s = s + "IV"; break;
              case 5: s = s + "V"; break;
              case 6: s = s + "VI"; break;
              case 7: s = s + "VII"; break;
              case 8: s = s + "VIII"; break;
              case 9: s = s + "IX"; break;
              default: cout << "The number is not in the given borders." << endl;
       }

       return s;
}


main()
{
      int n, n1, n2;
      cout << "Type a number between 1 and 50: ";
      cin >> n;


      n2 = n/10%10;

      n1 = n%10;

      cout << "Your roman number is " << rim( n2, n1 ) << "." << endl;


      return 0;
}
Topic archived. No new replies allowed.