M
MC felon
hi.
i've been trying to make this (simple but simply infruriating) project.
i've recently walked into STANDARD C++ and was working in Turbo all
this while. As a result, i'm not accustomed to the new lib. functions
of Gnu. here's my code for the app.(incidentally, i'm trying to make
the app code and decode letters.... like, store 'a' as 'j' and 'b' as
something else) however, when i compile it (on code::blocks), it says:
"this application has requested the runtime to terminate it in an
unusual way. Please contact the application's support team for more
information"
whats wrong?
#include <iostream>
#include <conio.h>
#include <string>
int main()
{
std::cout<<"rough engine of ecod\n\n";
std::cout<<"please input text\n\n";
std::string str;
int number_count = 0;
std::string out;
getline(std::cin,str);
str.push_back('\t');
while( str.at(number_count) != '\t')
{
number_count++;
}
for(int l = 0;l<number_count;l++)
{
if(str.at(l) == '\0')
{
out.at(l) = 'j';
}
if(str.at(l) == '.')
{
out.at(l) = 'k';
}
if(str.at(l) == 'a')
{
out.at(l) = '*';
}
if(str.at(l) == 'b')
{
out.at(l) = '-';
}
if(str.at(l) == 'c')
{
out.at(l) = 'l';
}
if(str.at(l) == 'd')
{
out.at(l) = 'm';
}
if(str.at(l) == 'e')
{
out.at(l) = 'n';
}
if(str.at(l) == 'f')
{
out.at(l) = 'p';
}
if(str.at(l) == 'g')
{
out.at(l) = 'q';
}
if(str.at(l) == 'h')
{
out.at(l) = 'r';
}
if(str.at(l) == 'i')
{
out.at(l) = 's';
}
if(str.at(l) == 'j')
{
out.at(l) = 't';
}
if(str.at(l) == 'k')
{
out.at(l) = 'u';
}
if(str.at(l) == 'l')
{
out.at(l) = 'v';
}
if(str.at(l) == 'm')
{
out.at(l) = 'w';
}
if(str.at(l) == 'n')
{
out.at(l) = 'x';
}
if(str.at(l) == 'o')
{
out.at(l) = 'y';
}
if(str.at(l) == 'p')
{
out.at(l) = 'z';
}
if(str.at(l) == 'q')
{
out.at(l) = 'a';
}
if(str.at(l) == 'r')
{
out.at(l) = 'b';
}
if(str.at(l) == 's')
{
out.at(l) = 'c';
}
if(str.at(l) == 't')
{
out.at(l) = 'd';
}
if(str.at(l) == 'u')
{
out.at(l) = 'e';
}
if(str.at(l) == 'v')
{
out.at(l) = 'f';
}
if(str.at(l) == 'w')
{
out.at(l) = 'g';
}
if(str.at(l) == 'x')
{
out.at(l) = 'h';
}
if(str.at(l) == 'y')
{
out.at(l) = 'i';
}
if(str.at(l) == 'z')
{
out.at(l) = 'i';
}
}
std::cout<<"\n\n";
std::cout<<"here's the coded version...\n\n";
std::cout<<out;
getch();
}
i've been trying to make this (simple but simply infruriating) project.
i've recently walked into STANDARD C++ and was working in Turbo all
this while. As a result, i'm not accustomed to the new lib. functions
of Gnu. here's my code for the app.(incidentally, i'm trying to make
the app code and decode letters.... like, store 'a' as 'j' and 'b' as
something else) however, when i compile it (on code::blocks), it says:
"this application has requested the runtime to terminate it in an
unusual way. Please contact the application's support team for more
information"
whats wrong?
#include <iostream>
#include <conio.h>
#include <string>
int main()
{
std::cout<<"rough engine of ecod\n\n";
std::cout<<"please input text\n\n";
std::string str;
int number_count = 0;
std::string out;
getline(std::cin,str);
str.push_back('\t');
while( str.at(number_count) != '\t')
{
number_count++;
}
for(int l = 0;l<number_count;l++)
{
if(str.at(l) == '\0')
{
out.at(l) = 'j';
}
if(str.at(l) == '.')
{
out.at(l) = 'k';
}
if(str.at(l) == 'a')
{
out.at(l) = '*';
}
if(str.at(l) == 'b')
{
out.at(l) = '-';
}
if(str.at(l) == 'c')
{
out.at(l) = 'l';
}
if(str.at(l) == 'd')
{
out.at(l) = 'm';
}
if(str.at(l) == 'e')
{
out.at(l) = 'n';
}
if(str.at(l) == 'f')
{
out.at(l) = 'p';
}
if(str.at(l) == 'g')
{
out.at(l) = 'q';
}
if(str.at(l) == 'h')
{
out.at(l) = 'r';
}
if(str.at(l) == 'i')
{
out.at(l) = 's';
}
if(str.at(l) == 'j')
{
out.at(l) = 't';
}
if(str.at(l) == 'k')
{
out.at(l) = 'u';
}
if(str.at(l) == 'l')
{
out.at(l) = 'v';
}
if(str.at(l) == 'm')
{
out.at(l) = 'w';
}
if(str.at(l) == 'n')
{
out.at(l) = 'x';
}
if(str.at(l) == 'o')
{
out.at(l) = 'y';
}
if(str.at(l) == 'p')
{
out.at(l) = 'z';
}
if(str.at(l) == 'q')
{
out.at(l) = 'a';
}
if(str.at(l) == 'r')
{
out.at(l) = 'b';
}
if(str.at(l) == 's')
{
out.at(l) = 'c';
}
if(str.at(l) == 't')
{
out.at(l) = 'd';
}
if(str.at(l) == 'u')
{
out.at(l) = 'e';
}
if(str.at(l) == 'v')
{
out.at(l) = 'f';
}
if(str.at(l) == 'w')
{
out.at(l) = 'g';
}
if(str.at(l) == 'x')
{
out.at(l) = 'h';
}
if(str.at(l) == 'y')
{
out.at(l) = 'i';
}
if(str.at(l) == 'z')
{
out.at(l) = 'i';
}
}
std::cout<<"\n\n";
std::cout<<"here's the coded version...\n\n";
std::cout<<out;
getch();
}