#include <iostream.h>
#include <ctype.h>
#include <vector>
#include <conio.h>
#include <string.h>
using std::vector;
using std::string;
std::vector<char *> nocode;
std::vector<char *> code;
std::string input("");
char inputs[500];
char y_n;
int x;
void encode();
int main()
{
do{
cout << "Input the line:" << endl;
cin.ignore(80, '\n');
cin.getline(inputs, 60);
cin.ignore(80, '\n');
input=inputs;
cout << endl;
cout << input << '\n';
system("CLS");
cout << "Unencrypted:\n";
cout << input;
encode();
cout << "Encrypted:\n";
cout << input;
input="";
cout << "Do another line? (y/n)";
cin >> y_n;
}while(tolower(y_n)!='n');
return 0;
}
void encode()
{
for(int x=0; x<int(input.size); x++)
{
if(toupper(input[x])=='A'||toupper(input[x])=='E'||toupper(input[x])=='I'||toupper(input[x])=='O'||toupper(input[x])=='U')
{
input[x]=input[x]-3;
if(input[x]<65)
{
input[x]=90-(65-input[x]); //make sure it's a letter
}
elseif(input[x]<97&&input[x]>90)
{
input[x]=122-(97-input[x]); //make sure it's a letter
}
}
else
{
input[x]=input[x]+5;
if(input[x]>122)
{
input[x]=97+(input[x]-122); //make sure it's a letter
}
elseif(input[x]>90&&input[x]<97)
{
input[x]=65+(input[x]-97); //make sure it's a letter
}
}
}
}
My errors are
"error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conve"
I have three of them, every time I try to output the string input. I can't use getline to receive "input," just as an addendum. Anybody know why I'm getting these errors? it's been almost an hour now and I still can't figure it out.
I wonder if this has to do with using std::string mixed with iostream.h's cout...
The preferred headers are #include <iostream> , etc. (without the .h). Then to bring each unknown symbol into scope you can use using std::symbol; or usingnamespace std; to bring them all in.
I've also been a little confuse with std::string, I don't think this is the same type of string one gets when he/she includes <string>, but I could be wrong. I don't really understand why you extract a char array and then convert it to a string, but that is another story.
I've seen so many people use #include <iostream.h> , when iostream.h is obselete. Use iostream (no extension) instead. Same with #include <string.h> and #include <string> , don't use the extension.
MSVC++ 6.0 Enterprise does not have iostream. This comes up every time. it uses non-standard headers. Today I gave up and switched to code::Blocks. Will keep you updated.
I'm being told that's illegal... x is of int type, and input is a string. Any ideas? I've tried typecasting (in fact I think it's typecasted above) but that didn't help.
Exact error:
error: invalid use of member (did you forget the '&'?)
I am not a programmer.
I was running a data analysis software for ecology and there was the following debug error:
heap corruption detected: before normal block (#271) at 0x026A8C68
Do you think I can ignore the error? what I have to resolve this?
The problem does not occurs with all .txt files with data which I import to the software. Only for some .txt.
Thank you very much
Regards
Jose
No. Heap errors need addressing as soon as they arise. I recommend reporting the error to the developers so that they can home-in on the issue. Be sure to provide a detailed report.
macedo wrote:
"The problem does not occurs with all .txt files with data which I import to the software. Only for some .txt."
Are the troublesome text files of a large capacity (2:4GB+)?
Send it to the developers of the software. As for your files, perhaps there data inside the file has the wrong format? Without a sample of the file, it's difficult to determine.
I don't want us to hijack this thread, so create a new discussion and we'll go from there.