Problem Link : Encyrption Message
My Solution : https://ideone.com/SS2bN0
I’m getting a compilation error, so what should I do to get proper ISO C++ Conversion?
Please help.
Problem Link : Encyrption Message
My Solution : https://ideone.com/SS2bN0
I’m getting a compilation error, so what should I do to get proper ISO C++ Conversion?
Please help.
Instead of
if (S[i] == "a"){
S[i] = "d";
}
do
if (S[i] == 'a'){
S[i] = 'd';
}
and so on for all other letters. Or even better - write it in a way that doesn’t require 26 if
statements
And you have also given the return type as string in the function.
in case it’s not clear: @chitreshapte 's post above tells you why you’re getting SIGSEV:
[~/devel/hackerrank/otherpeoples]>./compile-latest-cpp.sh
Compiling v_taken-NXS1.cpp
v_taken-NXS1.cpp: In function ‘std::__cxx11::string Convert(std::__cxx11::string)’:
v_taken-NXS1.cpp:5:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<S.length(); i++){
~^~~~~~~~~~~
v_taken-NXS1.cpp:86:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
Successful
[simon@simon-laptop][13:46:01]
[~/devel/hackerrank/otherpeoples]>echo "1
sausage" | ./a.out
vdxvdjh
v_taken-NXS1.cpp:4:8: runtime error: execution reached the end of a value-returning function without returning a value
I still don’t get it, can you correct my code?
Declare Convert
to return void
instead of string
.
I put void(string S)
instead of string(string S)
it’s giving WA???
Btw before 2-3 posts I have attached my new code
Please just link to your latest submission with each new post you make - it’s hard to keep track, otherwise.
All inputs are UPPER CASE, as should be all your output.
Edit:
Your solution doesn’t work with the sample testcase - please get that working first