I've had the same issue with the Jolly Jumper question, and the crypt kicker. The code i posted above is flawed, so i well need to fix it first. However, I have tested every case I can think of for my jolly jumper, traced my code several times and It still doesn't want to accept it.
EDIT: I finished the wertyu problem, and it is THEE simplest algorythm so I'm posting the code for it instead.
Code: Select all
using namespace std;
string first=" \n1234567890-QWERTYUIOPASDFGHJKL;ZXCVBNM,.";
string second=" \n234567890-=WERTYUIOP\\SDFGHJKL;'XCVBNM,./";
int linsearch(char a)
for(int i=0; i<first.length(); i++)
if(second[i] == a) return i;
while((temp = getchar())!=EOF)
cout << first[linsearch(temp)];
I will continue to try other problems and see if it will accept them, like my cryptkicker problem, with as many inputs as i can think of. I will post if anything comes up, but any suggestions would be gladly appreciated.
EDIT: ok i tried compiling with GCC instead of g++, and it failed with the error:
Undefined first referenced
symbol in file
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator(unsigned int) const/var/tmp//cckYUd2y.o
std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char)/var/tmp//cckYUd2y.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const/var/tmp//cckYUd2y.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
I've changed everything to unsigned and it still won't compile =\... GCC errors are so hard to read @.@.