|
|
|
|
|
|
|
|
roman_from_int takes an int and returns a string.| And what does return romnum do exactly. I've only used return 0 at the end of my programs. |
return /*anything*/; always exits the function and gives a value back to the function that called it. This is explained a bit more in the tutorial above.int num already has the value you want to convert inside it |
|
|
|
|
|
|
|
number = number - values[x]number -= values[x]array_name[5 + floor(sqrt(abs(x)/4.5)) + another_array[42 + b*3 - c]]5 + floor(sqrt(abs(x)/4.5)) + another_array[42 + b*3 - c] is an integer it would make sense to the compiler.variable = blah blah blah blah blah blah;blah blah blah blah blah blah evaluates to be variable's type
number be the integer the user enters and value[x] be the fixed number. So would this be how to do it: |
|
| BEARS wrote: |
|---|
| what is values[x] exactly? |
|
|
number is the number that the user wishes to convert.cout and deisplay thank you right away. You have to hit enter again for some reason. |
|
| BEARS wrote: |
|---|
| It compiles and runs, but it's not working correctly. Any idea how I can fix it? |
| me wrote: |
|---|
| Actually if statements are not even enough. What if the user enter 3687, 1000 needs to be subtracted three times... |
|
|
| BEARS wrote: |
|---|
| Also when i do enter a value, why doesn't the prgram go to the cout and deisplay thank you right away. You have to hit enter again for some reason. |
3697
-1000
-----
2697 M
-1000
-----
1697 MM
-1000
-----
697 MMM
- 500 (at this point in my head I skipped 900 because it was too big)
-----
197 MMMD
- 100 (I skipped 400 here)
-----
97 MMMDC
- 90
-----
7 MMMDCXC
- 5 (skipped several numerals because they were too big)
-----
2 MMMDCXCV
- 1
-----
1 MMMDCXCVI
- 1
-----
0 MMMDCXCVII |
int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; |
|
|
|
|
|