Numerals Problem

So this is what I have, it works but the problem is that it when
The output comes out it like this:

Please enter an integer 123
CXXIIIWould you like to convert another integer (y/n)?

I want the question after it though. How do I fix this??

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
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <iostream>
using namespace std;
int main()
{
    char repeat='y';
    while (repeat=='y' || repeat=='Y')
    {
    cout << "Please enter an integer ";
    int num;
    cin >> num;
    while (num >=1000) {
        cout <<"M";
        num = num - 1000;
}
 while (num ==900) {
        cout <<"CM";
        num = num - 900;
}
 while (num >=500) {
        cout <<"D";
        num = num - 500;
}
 while (num ==400) {
        cout <<"CD";
        num = num - 400;
}
 while (num >=100) {
        cout <<"C";
        num = num - 100;
}
 while (num >=90 && num<=99) {
        cout <<"XC";
        num = num - 90;
}
 while (num >=50) {
        cout <<"L";
        num = num - 50;
}
 while (num ==40) {
        cout <<"XL";
        num = num - 40;
}
 while (num >=10) {
        cout <<"X";
        num = num - 10;
}
  while (num ==9) {
        cout <<"IX";
        num = num - 9;
}
 while (num >=5) {
        cout <<"V";
        num = num - 5;
}
 while (num ==4) {
        cout <<"IV";
        num = num - 4;
}
 while (num >=1) {
        cout <<"I";
        num = num - 1;
}
    cout<<"Would you like to convert another integer (y/n)? "<<endl;
        cin>>repeat;
    }
  system("PAUSE");
    return 0;
}
Last edited on
Not sure if I'm understanding the question fully but you could use line feeds.

cout<<"\n\nWould you like to convert another integer (y/n)? "<<endl;

That would space out your numeral output and the repeat question.
This is what my output looks like:

1
2
Please enter an integer 123
CXXIIIWould you like to convert another integer (y/n)?


and I want it to look like this:

1
2
3
Please enter an integer 123
CXXIII
Would you like to convert another integer (y/n)?


So the question would come after.
Topic archived. No new replies allowed.