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
Write a SQL query to find the population of the planet named 'Caprica' -- 10 points Find the first name, last name, and age of p
Artemon [7]

The question is incomplete! Complete question along with answer and step by step explanation is provided below.

Please find the attached question.

Answer:

a) SQL Query:

SELECT population

FROM bsg_planets

WHERE name='Caprica';

b) SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE lname!='Adama';

c) SQL Query:

SELECT name, population

FROM bsg_planets

WHERE population > 2600000000

d) SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE age IS NULL;

Explanation:

a) Write a SQL query to find the population of the planet named 'Caprica'

Syntax:

SELECT  Column

FROM TableName

WHERE Condition;

For the given case,

Column = population

TableName  = bsg_planets

Condition = name='Caprica'

SQL Query:

SELECT population

FROM bsg_planets

WHERE name='Caprica';

Therefore, the above SQL query finds the population of the planet named 'Caprica' from the table bsg_planets.

b) Find the first name, last name, and age of people from bsg_people whose last name is not 'Adama'

Syntax:

SELECT  Column1, Column2, Column3

FROM TableName

WHERE Condition;

For the given case,

Column1 = fname

Column2 = lname

Column3 = age

TableName  = bsg_people

Condition = lname!='Adama'

SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE lname!='Adama';

Therefore, the above SQL query finds the first name, last name and age of people whose last name is not 'Adama' from the table bsg_people.

c) Find the name and population of the planets with a population larger than 2,600,000,000

Syntax:

SELECT  Column1, Column2

FROM TableName

WHERE Condition;

For the given case,

Column1 = name

Column2 = population

TableName  = bsg_planets

Condition = population > 2600000000

SQL Query:

SELECT name, population

FROM bsg_planets

WHERE population > 2600000000

Therefore, the above SQL query finds the name and population of the planets with a population larger than 2,600,000,000 from the table bsg_planets.

d) Find the first name, last name, and age of people from bsg_people whose age is NULL

Syntax:

SELECT  Column1, Column2, Column3

FROM TableName

WHERE Condition;

For the given case,

Column1 = fname

Column2 = lname

Column3 = age

TableName  = bsg_people

Condition = age IS NULL

SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE age IS NULL;

Therefore, the above SQL query finds the first name, last name and age of people whose age is NULL from the table bsg_people.

6 0
3 years ago
Read 2 more answers
What is abacus. List it's features in points.​
sleet_krkn [62]

Answer:

An abacus is a manual aid to calculating that consists of beads or disks that can be moved up and down on a series of sticks or strings within a usually wooden frame. The abacus itself doesn't calculate; it's simply a device for helping a human being to calculate by remembering what has been counted.

Explanation:

5 0
2 years ago
Write a query to display customer name, orderID, and productID for the orders that have more than one product.
Zanzabum

The query that displays the required data is

SELECT name, orderID, productID FROM Products WHERE Product > 1

<h3>How to rewrite the query?</h3>

To do this, we make use of the following parameters:

  • Table name: Products
  • Columns to read: name, orderID and productID
  • Condition: Product > 1

Next, we make use of the SELECT query

The syntax of the SELECT query is:

SELECT columns from table where condition

So, we have:

SELECT

name, orderID, productID

FROM Products

WHERE Product > 1

Read more about SQL query at:

brainly.com/question/19801436

#SPJ1

6 0
2 years ago
Once you start designing the processing logic for each function of your software, you might end up throwing out your logical dat
vlabodo [156]

Answer:

B. True.

Explanation:

Software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications.

An incremental model refers to the process in which the requirements or criteria of the software development is divided into many standalone modules until the program is completed.

Hence, an incremental method typically involves developing a system through repeated cycles and smaller portions at a time, enhancing and evolving the system over time.

A database schema is a structure which is typically used to represent the logical design of the database and as such represents how data are stored or organized and the relationships existing in a database management system. There are two (2) main categories of a database schema; physical database schema and logical database schema.

Hence, once you start designing the processing logic for each function of your software, you might end up throwing out your logical data model design and completely redesigning it because each function would use a specific processing logic respectively.

8 0
3 years ago
Authentication technologies are used by many organizations to _____.
sasho [114]

Answer:

C. confirm the identity of a user requesting access to information or assets

Explanation:

Authentication technologies are used by many organizations to confirm the identity of a user requesting access to information or assets. Authentication is used to secure data and ensure access is given to an authorized user. There are four main types of authentication technologies that can be used in an organisation. The first one is the password-based technology where a user provides a user id and a password to gain access to information. There is also a certificate-based technology which uses digital certificates to authenticate users. The third technology is the E-Token Based authentication where a device generates a random number whenever it is used, the number generated can be used in place of a password. The fourth alternative is biometric technology , which identify users by their physical characteristics such as their fingerprints, voice or facial features.

6 0
3 years ago
Other questions:
  • The price of an item was reduced 25% to $30. what was the original price of the item
    13·1 answer
  • Use unit analysis to determine the unit of measurement for the expression 10x + 25y​
    8·1 answer
  • Yara needs to provide step-by-step instructions to her staff on how to use a new system for
    15·1 answer
  • What is ovoviviparous? ​
    8·1 answer
  • Alison is having a hard time at work because her Inbox is flooded with emails every day. Some of these emails are unsolicited. S
    15·2 answers
  • Which of the following is a possible disadvantage of recursion? Question 10 options: Recursive solutions can be less efficient t
    8·1 answer
  • In Python what are the values passed into functions as input called?
    13·1 answer
  • What is a algorithm design ​
    11·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    6·1 answer
  • What are the 4 parts of an IP address
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!