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
What is (12.2a + 9.7b) – (18.1b – 0.2a) – (6.7a + 6.8b), simplified?
Inga [223]
The answer should be 5.7a - 15.2b
8 0
3 years ago
How are radio waves used on Earth?
kicyunya [14]

Uses of Radio Waves : The prime purpose of radio is to convey information from one place to another through the intervening media (i.e., air, space, nonconducting materials) without wires. Besides being used for transmitting sound and television signals, radio is used for the transmission of data in coded form.

8 0
3 years ago
Which components in your computer store data?
tresset_1 [31]

Answer:

mother board hope this helps

6 0
4 years ago
Read 2 more answers
allows users to enter text and control the computer with their voice.allows users to enter text and control the computer with th
solong [7]

Speech input software allows users to enter text and control the computer with their voice.

<h3>What is a speech software?</h3>

Speech recognition software is known to be a form of a computer program that is made to take the input of human speech and then they do interpret it, and change it into text.

Note that Speech input software allows users to enter text and control the computer with their voice.

Learn more about Speech input software from

brainly.com/question/27752622

#SPJ1

7 0
2 years ago
Enterprise software includes a database and thousands of predefined​ ________________.
kolezko [41]

Answer:

Business processes. Hope it helps!

4 0
2 years ago
Other questions:
  • Shaniya has misspelled a scientific name in her biology report. She needs to correct it, but she has no access to a computer. Sh
    13·2 answers
  • . Dеclarе a onе-dimеnsional array of 30 doublеs (on thе stack) namеd rainfall
    11·1 answer
  • Monetary Policy can be either Expansionary or Contractionary. Which of the following actions classify as Expansionary Monetary P
    7·2 answers
  • The length of time the valve is open, expressed in degrees of crankshaft rotation, is called camshaft
    10·1 answer
  • Suppose we have an arrayAofnprofessors; each teacher has two characteristics: difficulty (a numberin the range [0,10], where a h
    7·1 answer
  • The picture that graphically represents the items you use in windows is called a/an
    15·2 answers
  • Which is a disadvantage ofsimulation?
    5·1 answer
  • A student is conducting an experiment in which he adds an inhibitor to an enzyme-catalyzed reaction that contains alkaline phosp
    14·1 answer
  • Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the
    7·1 answer
  • 6. A genre of video game in which a player chooses a character and builds, upskills and modifies that character is referred to a
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!