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 your favorite anime?
ira [324]

Answer:

Fullmetal Alchemist: Brotherhood (160,975)

Explanation:

Fullmetal Alchemist: Brotherhood (160,975)

6 0
3 years ago
Which of the following is an advantage of software-defined networking (SDN)?
GREYUIT [131]

The option which represents an advantage of software-defined networking (SDN) is that it determines more granular control. Thus, the correct option for this question is D.

<h3>What is software-defined networking?</h3>

Software-defined networking may be characterized as an approach to networking that effectively utilizes software-based controllers or application programming interfaces (APIs) in order to communicate with underlying hardware infrastructure and direct traffic on a network.

According to the context of this question, the most common advantages of SDN are traffic programmability, agility, and the ability to create policy-driven network supervision and implement network automation.

Therefore, more granular control is an option that represents an advantage of software-defined networking (SDN). Thus, the correct option for this question is D.

To learn more about Software-defined networking, refer to the link:

brainly.com/question/24321959

#SPJ1

3 0
1 year ago
Using Python code.
Alika [10]

Answer:

def nametag(first_name, last_name):

return("{} {[0]}.".format(first_name, last_name))

print(nametag("Jane", "Smith"))

# Should display "Jane S."

print(nametag("Francesco", "Rinaldi"))

# Should display "Francesco R."

print(nametag("Jean-Luc", "Grand-Pierre"))

# Should display "Jean-Luc G."

Explanation:

First you must think about that the question ask about the first letter for last_name, remember [0] is the first letter not [1], the other part is about format function and its order

8 0
3 years ago
Saitama vs Goku Vs Luffy Vs Natsu Vs Trunks Vs Piccolo (Who would win and why)?
mamaluj [8]
This is actually a question?? Lol anywayyyy can I get ?
5 0
3 years ago
Read 2 more answers
4. A friend knows you are taking a technology class in college and asks you how a hard drive works. In your own words, describe
sveticcg [70]
Keep it simple... it holds whatever info' you want. would he/she understand?


3 0
3 years ago
Read 2 more answers
Other questions:
  • An iframe is an inline table for a website. True False i need an answer fast
    15·1 answer
  • How does a light bulb work
    7·2 answers
  • : Each individual data items of record is called a
    7·1 answer
  • Which scenario depicts an ethical workplace practice by a business owner? A. sharing personal information of its employees with
    8·2 answers
  • "What is the database in which Windows stores all information about hardware, applications, users and system settings?"
    8·1 answer
  • Two or more computers connected together is referred to as a(n)
    15·1 answer
  • Identify the data set level of measurement for the following: individual tax filing status (single, head of household, widowed,
    8·1 answer
  • Why is the ketboard calledQWERTY
    11·2 answers
  • A browser is an example of a<br>​
    10·1 answer
  • Which best describes how information is sent on the internet?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!