-1
尝试创建新的void函数时出现Expected ‘)’ before ‘;’ token
错误。expected')'before';'令牌函数
下面是摘录:
我不知道这个错误应该如何解决。我也有望在)
令牌之前使用加密技术。
using namespace std;
void ascii_to_bin()
{
string test;
int ascii;
int asciibinary;
unsigned int i = 0;
cout << "Enter a string: ";
getline (cin,test);
for (i = 0; i < test.size(); i++)
{
ascii = int(test[i]);
bitset<8> asciibinary (ascii);
cout << asciibinary << endl;
}
}
void calculate_binary(string binarystring; int stringlen)
{
int num_characters;
num_characters = (stringlen)/8;
int binary[8];
int asciinum;
char asciichar;
int j = 0;
i = 0;
for (int y = 0; y < num_characters; y++)
{
for (i = 0; i < 8; i++)
{
binary[i] = (int)binarystring[j]-48;
j++;
}
int power[8];
int counter = 7;
for (int c = 0; c < 8; c++)
{
power[c] = counter;
counter --;
}
for(int z = 0; z < 8; z++)
{
double a = binary[z];
double b = power[z];
asciinum += a*pow(2,b);
cout << asciinum << endl;
}
asciichar = asciinum;``
cout << asciichar << endl;
asciinum = 0;
}
}
您的错误消息是否包含行号?你检查过那个行号吗? – Tom 2015-02-08 21:51:46
事实上,在此行末尾有2个刻度线可能没有帮助: asciichar = asciinum;'' – 2015-02-08 21:57:28
请告诉我们正在标记的行号以及该行号的语句。 – jww 2015-02-08 21:59:08