Program.cpp
#include <iostream>
#include <bits/stdc++.h>
#include<fstream>
using namespace std;
int whole_xber_array[35];
string roman_array1[35],roman_array2[35];
string toLongRoman(int x){
int decimal[] =
{1000,900,500,400,100,90,50,40,10,9,5,4,1}; //base values
const char *symbol[] =
{"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
//roman symbols
int i = 0;
string s="";
while(x){ //repeat process until x is not
0
while(x/decimal[i]){
//first base value that divides x is largest base value
s+=symbol[i];
x -= decimal[i]; //subtract largest base value from x
}
i++;
//move to next base value to divide x
}
return s;
}
string toLower(string s){
transform(s.begin(),s.end(),s.begin(),::tolower);//convert string
to lowercase
return s;
}
int main()
{
ofstream oFile;
oFile.open("roman.txt");
int x,index=0;
do{
x=-1;
do{
cout<<"Enter the number ";
cin>>x;
}while(x<0 || x>5000);
string s=toLongRoman(x);
cout<<s<<endl;
if(x!=0) {
whole_xber_array[index]=x;
roman_array1[index]=s;
roman_array2[index]=toLower(s);
index++;
}
}while(x!=0);
string s="number\tRoman\tRoman small\n";
cout<<s;
oFile<<s;
for(int i=0;i<index;i++){
cout<<whole_xber_array[i]<<"\t"<<roman_array1[i]<<"\t"<<roman_array2[i]<<endl;
oFile<<whole_xber_array[i]<<"\t"<<roman_array1[i]<<"\t"<<roman_array2[i]<<"\n";//write
to file
}
oFile.close();//close file
return 0;
}
Output

Assignment Draw a flowchart, using Microsoft Visio or LucidChart, to document the logic required to complete...
This lab will exercise your understanding of some of the concepts covered in Chapter 10: classes, default constructors, overloaded constructors, arrays of classes A Roman numeral represents an integer using letters. Examples are XVII to represent 17, MCMLIII for 1953, and MMMCCCIII for 3303. By contrast, ordinary numbers such as 17 or 1953 are called Arabic numerals. The following table shows the Arabic equivalent of all the single-letter Roman numerals: M 1000 X 10 D 500 V 5 C...
*Answer must be in C* Write a complete program as follows (declare any necessary variables): Create an array of doubles named “hummus” with 2 rows and 300 columns. Initialize all array elements to zero. Write a loop that will repeatedly ask the user to enter a value and store it in the first row of the array (do not overwrite previously entered values) until the whole first row is populated with the user input. (hint the loop should have the...
Can someone code this asap? Use any language that you want.
2. Ancestral Names Given a list of strings comprised of a name and a Roman numeral, sort the list first by name, then by decimal value of the Roman numeral. In Roman numerals, a value is not repeated more than three times. At that point, a smaller value precedes a larger value to indicate subtraction. For example, the letter I represents the number 1, and Vrepresents 5. Reason through...
Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...
Please complete the following programming with clear explanations. Thanks! Homework 1 – Programming with Java: What This Assignment Is About? Classes (methods and attributes) • Objects Arrays of Primitive Values Arrays of Objects Recursion for and if Statements Selection Sort Use the following Guidelines: Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc.) Use upper case for constants. • Use title case (first letter is upper case) for classes. Use lower case with uppercase...
I need help as quick as possible, thanks beforehand. Please
provide the test output
The Lo Shu Magic Square is a grid with 3 rows and 3 columns shown below. 35 The Lo Shu Magic Square has the following properties: The grid contains the numbers 1 - 9 exactly The sum of each row, each column and each diagonal all add up to the same number. This is shown below: 15 4 92 15 - 81 + 15 15 15...
Using C Programming: (use printf, scanf)
18. Tic-Tac-Toc Game Write a program that allows two players to play a game of tic-tac-toc. Use a two- dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that Displays the contents of the board array Allows player 1 to select a location on the board for an X. The program should...
Using java :
In this exercise, you need to implement a class that encapsulate
a Grid. A grid is a useful concept in creating board-game
applications. Later we will use this class to create a board game.
A grid is a two-dimensional matrix (see example below) with the
same number of rows and columns. You can create a grid of size 8,
for example, it’s an 8x8 grid. There are 64 cells in this grid. A
cell in the grid...
For this exercise, you will complete the TicTacToe Board that we started in the 2D Arrays Lesson. We will add a couple of methods to the TicTacToe class. To track whose turn it is, we will use a counter turn. This is already declared as a private instance variable. Create a getTurn method that returns the value of turn. Other methods to implement: printBoard()- This method should print the TicTacToe array onto the console. The board should include numbers that...
DESCRIPTION Complete the program using Java to read in values from a text file. The values will be the scores on several assignments by the students in a class. Each row of values represents a specific student's scores. Each column represents the scores of all students on a specific assignment. So a specific value is a specific student's score on a specific assignment. The first two values in the text file will give the number of students (number of rows)...