String based error in basic algorithm for roman-numeral (using std::map)
I am self-teaching myself data-structures using Malik's "Data Structures and Algorithm Desgin using c++". The first exercise is to make an object of type numeralType
and encapsulate in it all the necessary operations to take in a string a return its value in the roman numeral system.
DISCALIMER 1: Please assume that there is data validation and everything is done except the function that converts the string into its value in the roman numeral system. Also, I am using VS17.
I will not post the original "conversion" function. Instead, I will post a generic version of the algorithm used in the function.
here it is:
#include <iostream>
#include <string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) +
charMap.at(testString.at(i + 1));
}
system("pause");
return 0;
}
This code automatically calls abort()
but compiles fine.
Using VS's debugger, i have singled out that the cause is string based, but I don't know exactly why.
Using a try/catch block I get that an invalid string position
error. Here is the try/catch version:
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
try
{
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) + charMap.at(testString.at(i + 1));
}
}
catch(const std::out_of_range& e)
{
std::cout << e.what() << std::endl;
}
system("pause");
return 0;
}
I have been scratching my head around this for a whole day now and would like a few tips on how to solve this problem.
Again, this is a generic version of an algorithm that takes in a string of roman numerals and returns it value as an integer.
DISCLAIMER 2: This algorithm implies addition only, based on the rules of addition/subtraction of the roman numeral system.
DISCALIMER 3: it is important to me that I use std::map, I know it can be done using an array/vector type, but I also wish to practice using stl containers.
Thank you in advance (no need to be terribly mean guys!!)
c++ string dictionary data-structures runtime-error
add a comment |
I am self-teaching myself data-structures using Malik's "Data Structures and Algorithm Desgin using c++". The first exercise is to make an object of type numeralType
and encapsulate in it all the necessary operations to take in a string a return its value in the roman numeral system.
DISCALIMER 1: Please assume that there is data validation and everything is done except the function that converts the string into its value in the roman numeral system. Also, I am using VS17.
I will not post the original "conversion" function. Instead, I will post a generic version of the algorithm used in the function.
here it is:
#include <iostream>
#include <string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) +
charMap.at(testString.at(i + 1));
}
system("pause");
return 0;
}
This code automatically calls abort()
but compiles fine.
Using VS's debugger, i have singled out that the cause is string based, but I don't know exactly why.
Using a try/catch block I get that an invalid string position
error. Here is the try/catch version:
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
try
{
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) + charMap.at(testString.at(i + 1));
}
}
catch(const std::out_of_range& e)
{
std::cout << e.what() << std::endl;
}
system("pause");
return 0;
}
I have been scratching my head around this for a whole day now and would like a few tips on how to solve this problem.
Again, this is a generic version of an algorithm that takes in a string of roman numerals and returns it value as an integer.
DISCLAIMER 2: This algorithm implies addition only, based on the rules of addition/subtraction of the roman numeral system.
DISCALIMER 3: it is important to me that I use std::map, I know it can be done using an array/vector type, but I also wish to practice using stl containers.
Thank you in advance (no need to be terribly mean guys!!)
c++ string dictionary data-structures runtime-error
add a comment |
I am self-teaching myself data-structures using Malik's "Data Structures and Algorithm Desgin using c++". The first exercise is to make an object of type numeralType
and encapsulate in it all the necessary operations to take in a string a return its value in the roman numeral system.
DISCALIMER 1: Please assume that there is data validation and everything is done except the function that converts the string into its value in the roman numeral system. Also, I am using VS17.
I will not post the original "conversion" function. Instead, I will post a generic version of the algorithm used in the function.
here it is:
#include <iostream>
#include <string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) +
charMap.at(testString.at(i + 1));
}
system("pause");
return 0;
}
This code automatically calls abort()
but compiles fine.
Using VS's debugger, i have singled out that the cause is string based, but I don't know exactly why.
Using a try/catch block I get that an invalid string position
error. Here is the try/catch version:
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
try
{
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) + charMap.at(testString.at(i + 1));
}
}
catch(const std::out_of_range& e)
{
std::cout << e.what() << std::endl;
}
system("pause");
return 0;
}
I have been scratching my head around this for a whole day now and would like a few tips on how to solve this problem.
Again, this is a generic version of an algorithm that takes in a string of roman numerals and returns it value as an integer.
DISCLAIMER 2: This algorithm implies addition only, based on the rules of addition/subtraction of the roman numeral system.
DISCALIMER 3: it is important to me that I use std::map, I know it can be done using an array/vector type, but I also wish to practice using stl containers.
Thank you in advance (no need to be terribly mean guys!!)
c++ string dictionary data-structures runtime-error
I am self-teaching myself data-structures using Malik's "Data Structures and Algorithm Desgin using c++". The first exercise is to make an object of type numeralType
and encapsulate in it all the necessary operations to take in a string a return its value in the roman numeral system.
DISCALIMER 1: Please assume that there is data validation and everything is done except the function that converts the string into its value in the roman numeral system. Also, I am using VS17.
I will not post the original "conversion" function. Instead, I will post a generic version of the algorithm used in the function.
here it is:
#include <iostream>
#include <string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) +
charMap.at(testString.at(i + 1));
}
system("pause");
return 0;
}
This code automatically calls abort()
but compiles fine.
Using VS's debugger, i have singled out that the cause is string based, but I don't know exactly why.
Using a try/catch block I get that an invalid string position
error. Here is the try/catch version:
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString = "lbxhf";
try
{
for (unsigned int i = 0; i < testString.length(); i++)
{
if (charMap.at(testString.at(i)) >= charMap.at(testString.at(i + 1)))
result = charMap.at(testString.at(i)) + charMap.at(testString.at(i + 1));
}
}
catch(const std::out_of_range& e)
{
std::cout << e.what() << std::endl;
}
system("pause");
return 0;
}
I have been scratching my head around this for a whole day now and would like a few tips on how to solve this problem.
Again, this is a generic version of an algorithm that takes in a string of roman numerals and returns it value as an integer.
DISCLAIMER 2: This algorithm implies addition only, based on the rules of addition/subtraction of the roman numeral system.
DISCALIMER 3: it is important to me that I use std::map, I know it can be done using an array/vector type, but I also wish to practice using stl containers.
Thank you in advance (no need to be terribly mean guys!!)
c++ string dictionary data-structures runtime-error
c++ string dictionary data-structures runtime-error
asked Dec 31 '18 at 17:00
SSBASESSBASE
166
166
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
You are accessing testString.at(i + 1)
, but i
may be up to testString.length()-1
because of the loop condition
for (unsigned int i = 0; i < testString.length(); i++)
This is the reason for the out-of-bounds exception. (testString.length()-1
is the last index of testString
and going one higher will be out-of-bounds.)
Not sure about your intentions, but maybe you want the loop condition to be
for (unsigned int i = 0; i+1 < testString.length(); i++)
to only compare neighboring elements of the string.
this version of the for loop doesn't throw an exception, yes, butresult
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(
– SSBASE
Dec 31 '18 at 17:29
Well then your program logic is wrong. For example you are not actually adding toresult
, you are assigning it a new value each time theif
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?
– user10605163
Dec 31 '18 at 17:32
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
Then what is theif
condition supposed to be for? Justresult += charMap.at(testString.at(i));
as loop body would do.
– user10605163
Dec 31 '18 at 17:34
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
|
show 5 more comments
Here's what I came up with to solve the problem and achieve my goal:
#include<iostream>
#include<string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString("lbxhf");
char lastChar = testString.back();
for (unsigned int i = 0; i+1 < testString.length(); i++)
{
if(charMap.at(testString.at(i)) >= charMap.at(testString.at(i+1)))
result += charMap.at(testString.at(i));
}
result += charMap.at(lastChar);
printf("%in", result);
system("pause");
return 0;
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53989738%2fstring-based-error-in-basic-algorithm-for-roman-numeral-using-stdmap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are accessing testString.at(i + 1)
, but i
may be up to testString.length()-1
because of the loop condition
for (unsigned int i = 0; i < testString.length(); i++)
This is the reason for the out-of-bounds exception. (testString.length()-1
is the last index of testString
and going one higher will be out-of-bounds.)
Not sure about your intentions, but maybe you want the loop condition to be
for (unsigned int i = 0; i+1 < testString.length(); i++)
to only compare neighboring elements of the string.
this version of the for loop doesn't throw an exception, yes, butresult
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(
– SSBASE
Dec 31 '18 at 17:29
Well then your program logic is wrong. For example you are not actually adding toresult
, you are assigning it a new value each time theif
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?
– user10605163
Dec 31 '18 at 17:32
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
Then what is theif
condition supposed to be for? Justresult += charMap.at(testString.at(i));
as loop body would do.
– user10605163
Dec 31 '18 at 17:34
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
|
show 5 more comments
You are accessing testString.at(i + 1)
, but i
may be up to testString.length()-1
because of the loop condition
for (unsigned int i = 0; i < testString.length(); i++)
This is the reason for the out-of-bounds exception. (testString.length()-1
is the last index of testString
and going one higher will be out-of-bounds.)
Not sure about your intentions, but maybe you want the loop condition to be
for (unsigned int i = 0; i+1 < testString.length(); i++)
to only compare neighboring elements of the string.
this version of the for loop doesn't throw an exception, yes, butresult
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(
– SSBASE
Dec 31 '18 at 17:29
Well then your program logic is wrong. For example you are not actually adding toresult
, you are assigning it a new value each time theif
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?
– user10605163
Dec 31 '18 at 17:32
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
Then what is theif
condition supposed to be for? Justresult += charMap.at(testString.at(i));
as loop body would do.
– user10605163
Dec 31 '18 at 17:34
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
|
show 5 more comments
You are accessing testString.at(i + 1)
, but i
may be up to testString.length()-1
because of the loop condition
for (unsigned int i = 0; i < testString.length(); i++)
This is the reason for the out-of-bounds exception. (testString.length()-1
is the last index of testString
and going one higher will be out-of-bounds.)
Not sure about your intentions, but maybe you want the loop condition to be
for (unsigned int i = 0; i+1 < testString.length(); i++)
to only compare neighboring elements of the string.
You are accessing testString.at(i + 1)
, but i
may be up to testString.length()-1
because of the loop condition
for (unsigned int i = 0; i < testString.length(); i++)
This is the reason for the out-of-bounds exception. (testString.length()-1
is the last index of testString
and going one higher will be out-of-bounds.)
Not sure about your intentions, but maybe you want the loop condition to be
for (unsigned int i = 0; i+1 < testString.length(); i++)
to only compare neighboring elements of the string.
answered Dec 31 '18 at 17:05
user10605163user10605163
2,858624
2,858624
this version of the for loop doesn't throw an exception, yes, butresult
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(
– SSBASE
Dec 31 '18 at 17:29
Well then your program logic is wrong. For example you are not actually adding toresult
, you are assigning it a new value each time theif
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?
– user10605163
Dec 31 '18 at 17:32
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
Then what is theif
condition supposed to be for? Justresult += charMap.at(testString.at(i));
as loop body would do.
– user10605163
Dec 31 '18 at 17:34
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
|
show 5 more comments
this version of the for loop doesn't throw an exception, yes, butresult
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(
– SSBASE
Dec 31 '18 at 17:29
Well then your program logic is wrong. For example you are not actually adding toresult
, you are assigning it a new value each time theif
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?
– user10605163
Dec 31 '18 at 17:32
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
Then what is theif
condition supposed to be for? Justresult += charMap.at(testString.at(i));
as loop body would do.
– user10605163
Dec 31 '18 at 17:34
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
this version of the for loop doesn't throw an exception, yes, but
result
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(– SSBASE
Dec 31 '18 at 17:29
this version of the for loop doesn't throw an exception, yes, but
result
should sum up to 15 and instead it sums up to 3, further debugging shows that for some reason, the characters of the string cannot be read :(– SSBASE
Dec 31 '18 at 17:29
Well then your program logic is wrong. For example you are not actually adding to
result
, you are assigning it a new value each time the if
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?– user10605163
Dec 31 '18 at 17:32
Well then your program logic is wrong. For example you are not actually adding to
result
, you are assigning it a new value each time the if
condition is satisfied. I don't follow your intentions at all. Do you want to map each character to its integer value and then build the sum of those values?– user10605163
Dec 31 '18 at 17:32
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
yes, that's basically it, and i see what you mean! dammit!! haha if that is the case i may be able to solve the problem
– SSBASE
Dec 31 '18 at 17:33
Then what is the
if
condition supposed to be for? Just result += charMap.at(testString.at(i));
as loop body would do.– user10605163
Dec 31 '18 at 17:34
Then what is the
if
condition supposed to be for? Just result += charMap.at(testString.at(i));
as loop body would do.– user10605163
Dec 31 '18 at 17:34
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
in the roman numeral system, for example, lets say 'x' = 3 and 'b'=4. Now, the rules for addition and subtraction in that system state that if a larger numeral is placed before a smaller numeral, then that means addit-on (i.e "bx" = 7) otherwise, it means subtraction (i.e "xb" = 1)
– SSBASE
Dec 31 '18 at 17:37
|
show 5 more comments
Here's what I came up with to solve the problem and achieve my goal:
#include<iostream>
#include<string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString("lbxhf");
char lastChar = testString.back();
for (unsigned int i = 0; i+1 < testString.length(); i++)
{
if(charMap.at(testString.at(i)) >= charMap.at(testString.at(i+1)))
result += charMap.at(testString.at(i));
}
result += charMap.at(lastChar);
printf("%in", result);
system("pause");
return 0;
}
add a comment |
Here's what I came up with to solve the problem and achieve my goal:
#include<iostream>
#include<string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString("lbxhf");
char lastChar = testString.back();
for (unsigned int i = 0; i+1 < testString.length(); i++)
{
if(charMap.at(testString.at(i)) >= charMap.at(testString.at(i+1)))
result += charMap.at(testString.at(i));
}
result += charMap.at(lastChar);
printf("%in", result);
system("pause");
return 0;
}
add a comment |
Here's what I came up with to solve the problem and achieve my goal:
#include<iostream>
#include<string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString("lbxhf");
char lastChar = testString.back();
for (unsigned int i = 0; i+1 < testString.length(); i++)
{
if(charMap.at(testString.at(i)) >= charMap.at(testString.at(i+1)))
result += charMap.at(testString.at(i));
}
result += charMap.at(lastChar);
printf("%in", result);
system("pause");
return 0;
}
Here's what I came up with to solve the problem and achieve my goal:
#include<iostream>
#include<string>
#include<map>
int main()
{
int result = 0;
std::map<char, int> charMap = { {'f',1},{'h',2},{'x',3},{'b',4},{'l',5} };
std::string testString("lbxhf");
char lastChar = testString.back();
for (unsigned int i = 0; i+1 < testString.length(); i++)
{
if(charMap.at(testString.at(i)) >= charMap.at(testString.at(i+1)))
result += charMap.at(testString.at(i));
}
result += charMap.at(lastChar);
printf("%in", result);
system("pause");
return 0;
}
answered Jan 1 at 16:26
SSBASESSBASE
166
166
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53989738%2fstring-based-error-in-basic-algorithm-for-roman-numeral-using-stdmap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown