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 earning potential?
Natalka [10]

Answer:

Earning potential often refers to the top salary for a particular field or profession. In the finance world, the meaning is not much different: earning potential is the biggest profit a company could potentially make.

Explanation:

Earning potential often refers to the top salary for a particular field or profession. In the finance world, the meaning is not much different: earning potential is the biggest profit a company could potentially make.

4 0
3 years ago
What are the advantages of mine shaft gear and the disadvantaged​
romanna [79]

Answer:

One sheave means that you are using a single drum winder. They are the worst! Double drum winders control easier, brake better and are much more efficient. They save time ( two skips or cages) and can be clutched to perform faster shift transport. A single drum is slow, unbalanced and can be a nightmare if it trips out during hoisting. If the brake system is not perfect it can be a real hairy experience. For a runaway single drum, there is no counterbalance effect. It always runs to destruction. With a double drum, the driver still has a chance to control the winder to a certain extent and he has two sets of brakes to rely on. A single sheave could also mean a shaft with a single compartment. No second means of escape unless there are ladders or stairways. Not a very healthy situation.

Those are just a few points. I am sure much more can be said in favor of a double drum winder and two or more sheaves in the headgear. Most of the shafts I have worked at have multiple winders and up to ten compartments. They all have a small single drum service winder for emergencies and moves of personnel during shift times. They are referred to as the Mary - Annes. Apparently, the name originated in the U.K. where an aristocratic mine owner named the first such winder after his mistress.

Explanation:

<em>Hope you got it </em>

<em>If you have any question just ask me</em>

<em>If you think this is the best answer please mark me as BRAINLIEST</em>

5 0
3 years ago
Percentage-wise, which renewable energy source is used most?
Natasha2012 [34]
C)Hydroelectric I believe.
5 0
3 years ago
How many fnaf games did Scott Cawthon make?
MrMuchimi

Answer:

8 but he is making FNaF security breach

Explanation:

there is FNaF VR help wanted

7 0
3 years ago
Blogs differ from most other online text sources because they
allochka39001 [22]
Tell you what a person's life is like
4 0
3 years ago
Read 2 more answers
Other questions:
  • Background Susan finished work on system architecture issues, and her system design specification was approved. Now she is ready
    15·1 answer
  • What are six external parts of a computer
    11·1 answer
  • What occurs when you call a method on a reference variable that contains null? Select one: a. An ArrayIndexOutOfBoundsException
    11·1 answer
  • Rapid development programming languages eliminate the possibility of having bugs in code. True or False
    8·1 answer
  • What was the major sign that lead Professor Shiller to predict the crash of the housing market​
    6·1 answer
  • What are the ethical implications of online social media after someone has died
    8·2 answers
  • Fair Use means a teacher can take the contents of a web activity page and repost it in your school's web site because it is for
    7·1 answer
  • Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius va
    9·1 answer
  • How are web design &amp; web development different from each other?
    9·1 answer
  • The most widely used computer device​
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!