1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
joja [24]
3 years ago
10

Write a program roman which converts numbers from decimal notation into Roman numerals. roman takes a single argument, a string

containing a non-negative integer, and prints its Roman numeral equivalent to standard output. g
Computers and Technology
1 answer:
MaRussiya [10]3 years ago
3 0

Answer:

// Program is written in C++ programming language

/ Comments are used for explanatory purpose

// Program starts here

#include<bits/stdc++.h>

using namespace std;

//Declare a function named value to represent the symbols of Roman Numerals

int value(char xy)

{

if (xy == 'I') { return 1; }

if (xy == 'V') { return 5; }

if (xy == 'X') { return 10; }

if (xy == 'L') { return 50; }

if (xy == 'C') { return 100; }

if (xy == 'D') { return 500; }

if (xy == 'M') { return 1000; }

return -1;

}

// Convert to numbers , taking Variable named input as input

int Converted(string &input)

{

// Declare a variable to store the calculated output

int calc;

// Set to 0

calc = 0;

// Iterate through input from 0 to the last character

for (int i=0; i<input.length(); i++)

{

int check1 = value(input[i]);

if (i+1 < input.length())

{

int check12= value(input[i+1]);

// Comparing both values

if (check1>= check2)

{

calc+ =check1;

}

else

{

calc+ =check2 - check1;

i++;

}

}

else

{

calc+ =check1;

}

}

return calc;

}

// Main method starts here

int main()

{

// String input declaration

string inp;

cout<"Enter any valid Roman numeral";

cout << "Result is "

<< Converted(inp);

return 0;

}

You might be interested in
When the tv was created (year)
nikitadnepr [17]

Answer:

1927

Explanation:

6 0
2 years ago
Read 2 more answers
How can a robot differentiate between positive or negative product reviews?
Levart [38]

Answer:

Some of the sites have the rating system for example 3 stars, or the bot has a feature that can capture keywords that include a list of possible indicator that it is a negative review. For example if a user review includes a word "bad" or "horrible" the bot will flag that as a negative review.

Please give brainliest.

3 0
2 years ago
Write any four common hardware devices​
marishachu [46]

Answer:

Input devices: For raw data input.

Processing devices: To process raw data instructions into information.

Output devices: To disseminate data and information.

Storage devices: For data and information retention.

8 0
2 years ago
Imagine that you only used assignment statements for the design of the seven-segment display decoder. How would you obtain the B
Basile [38]

Answer:

Please see the attached file for the complete answer.

Explanation:

Download pdf
6 0
3 years ago
TO COMPUTING IN BUSINE
Diano4ka-milaya [45]

Answer:

<em>the</em><em> </em><em>correct</em><em> </em><em>answer</em><em> </em><em>is</em><em> </em><em>a.</em><em> </em><em>Word</em><em> </em><em>processing</em><em>.</em>

Explanation:

<em><u>hope</u></em><em><u> </u></em><em><u>this</u></em><em><u> </u></em><em><u>works</u></em><em><u> </u></em><em><u>out</u></em><em><u>!</u></em><em><u>!</u></em><em><u>!</u></em><em><u>!</u></em><em><u>!</u></em>

5 0
3 years ago
Other questions:
  • When is the bond between the actin and myosin head is broken? when an ATP molecule binds to the myosin head when an ATP molecule
    6·1 answer
  • The "instance" relationship shows that something is an object of a ____.
    5·1 answer
  • Create a detail report that will display all SCR courses in alphabetical order, with the course name and the instructor name in
    5·1 answer
  • WILL DO A BRIANLY! Use an algorithm to help the Python Turtle get to the finish line in 10 steps by using only the 3 commands be
    12·1 answer
  • Lisa is modifying a spreadsheet. Which view will allow Lisa to see how her changes will look when she prints the spreadsheet?
    13·2 answers
  • What is the best use of a line chart? to show parts of a whole while emphasizing specific data to compare and contrast discrete
    9·2 answers
  • The full meaning of ENIAC,ABACUS,EDVAC,EDSAC<br>and explain ​
    7·1 answer
  • Match each term in the second column with its correct definition in the first column. Write the letter of the term on the blank
    12·1 answer
  • Who has a brainpop acct. can i pls use it !
    12·1 answer
  • I need help now I really do what is the answer thank you
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!