C++ 我一直在尝试调试这个加密算法。无法确定错误是什么

C++ 我一直在尝试调试这个加密算法。无法确定错误是什么,c++,c++11,g++,C++,C++11,G++,g++编译器错误: encrpyt.cpp: In function ‘int main()’: encrpyt.cpp:24:35: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive] encrpyt.cpp:11:6: error: initializing argument 1 of ‘void doencrypt(char, char)’ [-fpermissive] encrpyt.cpp:24:35: e

g++编译器错误:

encrpyt.cpp: In function ‘int main()’:
encrpyt.cpp:24:35: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
encrpyt.cpp:11:6: error:   initializing argument 1 of ‘void doencrypt(char, char)’ [-fpermissive]
encrpyt.cpp:24:35: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
encrpyt.cpp:11:6: error:   initializing argument 2 of ‘void doencrypt(char, char)’ [-fpermissive]
encrpyt.cpp:28:36: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
encrpyt.cpp:12:6: error:   initializing argument 1 of ‘void dodecrypt(char, char)’ [-fpermissive]
encrpyt.cpp:28:36: error: invalid conversion from ‘char*’ to ‘char’ [-fpermissive]
encrpyt.cpp:12:6: error:   initializing argument 2 of ‘void dodecrypt(char, char)’ [-fpermissive]
encrpyt.cpp: In function ‘void dodecrypt(char*, char)’:
encrpyt.cpp:85:30: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
In file included from encrpyt.cpp:2:0:
/usr/include/c++/4.7/fstream:629:7: error:   initializing argument 1 of ‘std::basic_ofstream<_CharT, _Traits>::basic_ofstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]’ [-fpermissive]
encrpyt.cpp:89:13: error: statement cannot resolve address of overloaded function
encrpyt.cpp:90:15: error: statement cannot resolve address of overloaded function
encrpyt.cpp:在函数“int main()”中:
encrpyt.cpp:24:35:错误:从“char*”到“char”[-fppermissive]的转换无效
encrpyt.cpp:11:6:错误:初始化'void doencrypt(char,char)'[-fppermissive]的参数1
encrpyt.cpp:24:35:错误:从“char*”到“char”[-fppermissive]的转换无效
encrpyt.cpp:11:6:错误:初始化'void doencrypt(char,char)'[-fppermissive]的参数2
encrpyt.cpp:28:36:错误:从“char*”到“char”[-fpermissive]的转换无效
encrpyt.cpp:12:6:错误:初始化'void dodecrypt(char,char)'[-fppermissive]的参数1
encrpyt.cpp:28:36:错误:从“char*”到“char”[-fpermissive]的转换无效
encrpyt.cpp:12:6:错误:初始化'void dodecrypt(char,char)'[-fppermissive]的参数2
encrpyt.cpp:在函数“void dodecrypt(char*,char)”中:
encrpyt.cpp:85:30:错误:从“char”到“const char*”的转换无效[-fppermissive]
在encrpyt.cpp中包含的文件中:2:0:
/usr/include/c++/4.7/fstream:629:7:错误:初始化“std::basic_of stream::basic_of stream(const char*,std::ios_base::openmode)”的参数1)[with _CharT=char;_Traits=std::char\u Traits;std::ios_base::openmode=std:_ios_openmode][-fppermissive]
encrpyt.cpp:89:13:错误:语句无法解析重载函数的地址
encrpyt.cpp:90:15:错误:语句无法解析重载函数的地址
代码:

#包括
#包括
使用std::cout;
使用std::cin;
使用std::endl;
使用std::ifstream;
使用std::of流;
int菜单();
void加密(ifstream&,ofstream&);
无效解密(ifstream&,ofstream&);
void不加密(char,char);
空十二色(半焦,半焦);
int main(){
int ans=菜单();
字符输入文件[100];
字符输出文件[100];
char outputfile2[100];
while(ans!=3){
如果(ans==1){
不能

void doencrypt(char,char);
void dodecrypt(char,char);
取字符
(例如字母“a”)。 您尝试给它一个char指针
char inputfile[100];

从上下文来看,我认为上面的签名是错误的

更新:确定解决方案是更改签名:

void doencrypt(char*,char*);
void dodecrypt(char*,char*);

您已声明使用字符的函数: e、 g

并尝试发送一个
字符*

char inputfile[100];
char outputfile[100];
//...
doencrypt(inputfile, outputfile);
您在
dodecrypt


更改签名以匹配实际功能。

读取字符时需要提供c的地址:

        input.get(&c); // Line 35

页面顶部的声明错误。应使用char*作为参数

void doencrypt(char*,char*);
void dodecrypt(char*,char*);
在函数dodecrypt中,您还忘记了括号

input.close();
output2.close();

你的函数原型与它们的实现不匹配…char与char[]不同。你应该多学习一些基础知识。
char
肯定不同于
char[100]
!可能应该发布答案而不是注释lol,OP肯定需要从头开始。
void doencrypt(char*,char*);
void dodecrypt(char*,char*);
input.close();
output2.close();