Roman Numeral with Parallel Array

I am working on a program taking numbers and turning them into roman numerals both capital and lower case.
here are my instructions:
1.user defined function "toLongRoman" accepts whole number (1-9999) and returns string containing uppercase roman numeral equivalent.
2. User developed function "toLower" accepts a string and returns a lower-case version of input string.
3. Declare two parallel arrays of 20 rows each: one dimensional (whole #'s); one two dimensional (20 rows, 2 columns) of strings.
4. Request and read a single positive whole number form the user. Verify its (1-5000). Request a replacement value if original is invalid.
5.Use a loop to iterate from the input value thru the next 19 consecutive values, storing values in whole number array.
6. Generate long-form upper-case roman numeral equivalent of each value in whole number array (using the "toLongRoman" function, and store it in the corresponding row and first column of the string array.
7. Convert each upper-case roman numeral to its lower case equivalent with your "toLower" function and store the lower-case roman numeral in the corresponding row, but second column of the string array.
8. After all 40 (20 upper case, 20 lower case) roman numeral have been generated and stored in the string array, use a separate loop to display the contents of both arrays in form 23=XXIII=xxiii.

I think I have done 1,2,3,half of 4, and 5 right. Could someone look at this program and let me know if I am going in the right direction with this program. I'm still working on 6, 7, and 8.

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
69
70
71
72
73
 #include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;


const int NUMBER_OF_ROWS = 20;
const int NUMBER_OF_COLUMNS = 2;
typedef int tableRoman[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS];
tableRoman matrix;
void init(tableRoman table)
{
	int row;
	int col;

	for (row = 0; row < NUMBER_OF_ROWS; row++)
		for (col = 0; col < NUMBER_OF_COLUMNS; col++)
			table[row][col] = 0;
}
 
 /*void wholeArray(const int list[], int rNum)
 {
	 int number;
	 int wholeNum = 0;
	 for (rNum = */
int main()
{

	int toLongRoman = (1-9999);
	string s1[11];

	for ( int i=0; i<20; i++)
	{
		s1[i] = " ";
		char I = 1;
		char V = 5;
		char X = 10;
		char L = 50;
		char C = 100;
		char D = 500;
		char M = 1000;
	}

	int toLower = (1-9999);
	string s2[11];
	
	for ( int j=0; j<20; j++)
	{
		s2[j] = " ";
		char i = 1;
		char v = 5;
		char x = 10;
		char l = 50;
		char c = 100;
		char d = 500;
		char m = 1000;
	}

	int list[20];
	int i;
	for (i = 0; i < 20; i++ )
		cin >> list[i];
	cout << "Enter a number in the range 1-5000: " << endl;

	enum {I, V, X, L, C, D, M} R1Number;
	enum {i, v, x, l, c, d, m} R2Number;
	


	system("pause");
	return 0;
}
 
You are confusing the concept of a function and a variable. The instructions say to create functions called toLongRoman and toLower.

user defined function "toLongRoman" accepts whole number (1-9999) and returns string containing uppercase roman numeral equivalent.


1
2
3
4
5
6
7
8
9
10
std::string toLongRoman(unsigned int WNumber)
{
   std::string Uppercase
//...do the checking for bounds here
//convert the string to uppercase.  You can do this using a function called
//toUpper, or subtract 32 from the char.

//then you return the string
return Uppercase;
};
pogrady-- I want to thank you for the information given! It has helped me a bunch!
Topic archived. No new replies allowed.