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
Go follow me plz i would appreciate it
aleksandr82 [10.1K]
Hejdjxuxudjjdjdbdbdbd
6 0
2 years ago
Read 2 more answers
If you like to play graphic-intensive games on your computer and you find that your computer can't keep up, you can add a ______
nikklg [1K]
The answer is - video card
3 0
4 years ago
Please!! I need help, this is due by tonight!!!
lyudmila [28]

Answer:

sorry if it is too late but I think it is d

Explanation:

4 0
3 years ago
Write an algorithm to settle the following question:
Vesnalui [34]

Answer:

<u>algorithm</u>

original = float(raw_input("Enter initial balance: "))

interest = float(raw_input("Enter promised return: "))

expenses = float(raw_input("Enter monthly expenses: "))

interest = interest / 100 / 12

month = 0

balance = original

if balance * interest - expenses >= 0:

print "You don't need to worry."

else:

while balance + balance * interest - expenses >= 0: # negation of the if condition

balance = balance + interest * balance # in one month

balance = balance - expenses

month = month + 1

print month, balance

print month / 12, "years and", month % 12, "months"

6 0
3 years ago
What's the best way that Safiya can improve the machine learning algorithm's ability to detect all pedestrians
Vinil7 [7]

The best way that Safiya can improve the machine learning algorithm's ability to detect all pedestrians is; As detailed below.

<h3>What is a machine algorithm?</h3>

Machine learning algorithms are mathematical model mapping methods used to learn or uncover underlying patterns embedded in the data.

Now, Machine learning comprises a group of computational algorithms that can carry out pattern recognition, classification, and prediction on data by learning from existing data set.

In this question, the best way that Safiya can improve the machine learning algorithm's ability to detect all pedestrians is She can add videos of people using wheelchairs and strollers into the training data set (perhaps crowd-sourcing them if there are none already available).

Read more about Machine Learning Algorithm at; brainly.com/question/21928505

8 0
2 years ago
Other questions:
  • How much does a Canon PowerShot G7X cost in America?
    14·1 answer
  • Why is soccer the most popular sport
    7·2 answers
  • c++ You are given an array A representing heights of students. All the students are asked to stand in rows. The students arrive
    5·1 answer
  • Why would you use a billeted list in a slide presentation?
    11·1 answer
  • Which of these image sizes takes the most storage space?
    8·2 answers
  • Consider a system that uses a 32-bit unique salt where users have a 4-digit number as a password (e.g. 6813). Eve wants to crack
    8·2 answers
  • You want to divide the value in cell D3 by the value in cell E3. Which formula should you use?
    11·2 answers
  • Why did artists use pinhole cameras during the renaissance?
    9·1 answer
  • In which circumstances would the view side by side feature be useful or helpful.
    15·2 answers
  • Michael is stuck due to an electric shock generated at the fridge. What should you do to save michael?.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!