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
So im new how exactly does this point system work???​
lapo4ka [179]

Answer:

Ok so basicly every time you see a question and you can answer it you press on the answer bar you type in your answers then you will automaticly get points depending on the question you answer, you need to get more than 5+ to ask a question  of your own

Explanation:

5 0
3 years ago
Creating a call conversion in Google Ads and adding a phone snippet to a web page allows advertisers to use a Google forwarding
Marta_Voda [28]

Answer:

Call tracking system

Explanation:

It helps to measure total amount of visitors per month and based on the volume of visitors, it calculates how many phone numbers should be displayed to show a different number for each clique.

5 0
3 years ago
Your brother is starting 9th grade next year and is thinking about going to college. What step would you recommend he take?
postnew [5]
I would say D. Usually students aren't expected to fill out the FAFSA till junior or senior year, this is because it is based on household income which may change every year. Also, guidance counselor's can help students on the right track to go to classes. Clubs and/or sports teams look really good on college applications and are usually preferred by colleges. 
4 0
3 years ago
Write a paragraph expressing how you'd use the computer to enhance your place of work.​
Charra [1.4K]

Answer:

Have water by, have it organized, and have notes by you welcome.

Explanation:

4 0
3 years ago
network consisting of computers and other devices that are eithrr fully or partially connected to each other
tekilochka [14]

The answer is a Mesh topology. This method connects every device to each other device in the network. A wired full-mesh topology is not as common as it is impractical and highly expensive. A partial mesh topology offers redundancy if one of the connections goes down and usually uses a connecting medium such as a router to eliminate cables and expensive PCI NIC's.

8 0
3 years ago
Other questions:
  • How does microchip work
    12·1 answer
  • You would set a ___________ to prevent users from immediately changing their password several times in one day to return to the
    15·2 answers
  • What is the internet?
    5·2 answers
  • 1.Electromagnetic waves can carry more data at higher frequencies. Why would a scientist opt to transmit data at a lower frequen
    12·1 answer
  • You are given the task of reading in n numbers and then printing them out in sorted order. Suppose you have access to a balanced
    12·1 answer
  • What error occurs in the following program? #include using namespace std; int main() { int number1, number2, sum; cout &lt;&lt;
    13·1 answer
  • In the context of computer and network security, _____ means that a system must not allow the disclosing of information by anyon
    10·1 answer
  • Why is lateral reading an important tool when reading material in social media or any online source
    15·1 answer
  • Is a free verse a poetry that has no images
    5·2 answers
  • Write a Pascal program that will prompt the user to enter the radius of a circle.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!