Hey everybody,
I was having trouble completing my last assignment which required me to redesign a C program into a C++ program using classes and objects.
So far my Cpp code looks like this:
insertThis code is supposed to take a ciphertext line by line from a file and output it onto the screen using C++. Basically, all I did was take the function I had earlier that is supposed to perform this operation and copied it into the object above. But, after compiling, I am getting errors saying:Code:class Ciphertext{ public: void output_ciphertext_screen(struct key_element key[26], FILE * fp); }; void Ciphertext::output_ciphertext_screen(struct key_element key[26], FILE * fp) { int i; fprintf(fp,"\n"); fprintf(fp,"Encoded : "); for(i=0;i<26;i++) fprintf(fp,"%c ",key[i].enc); fprintf(fp,"\n"); fprintf(fp,"Decoded : "); for(i=0;i<26;i++) if(key[i].man_flag == 0) fprintf(fp,"%c ",key[i].dec); else if(fp==stdout) printf("%c ",toupper(key[i].dec)); else fprintf(fp,"%c ",key[i].dec); fprintf(fp,"\n\n"); } int main() { output_ciphertext_screen print(key, stdout); }
error C2065: 'output_ciphertext_screen' : undeclared identifier.
I am new to C++ and am trying to get a better grasp of it so if you could point me in the right direction by showing me where my code is wrong or just giving me some tips, I should be able to figure out the rest of the program.
Thanks in advance,
Andy